Last active
August 30, 2021 08:43
-
-
Save weppos/9273e3c8f65c08e63892b7e723b760ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ publicsuffix-go git:(master) ✗ cd ~/go/src/golang.org/x/net/idna; git co 69d4b8; cd -; go run idna-test.go | |
Note: checking out '69d4b8'. | |
You are in 'detached HEAD' state. You can look around, make experimental | |
changes and commit them, and you can discard any commits you make in this | |
state without impacting any branches by performing another checkout. | |
If you want to create a new branch to retain commits you create, you may | |
do so (now or later) by using -b with the checkout command again. Example: | |
git checkout -b <new-branch-name> | |
HEAD is now at 69d4b8a... http2: remove unnecessary TODO for trailer keys allocation | |
~/go/src/github.com/weppos/publicsuffix-go | |
Empty string works! | |
Result: `` | |
➜ publicsuffix-go git:(master) ✗ cd ~/go/src/golang.org/x/net/idna; git co 67957f; cd -; go run idna-test.go | |
Previous HEAD position was 69d4b8a... http2: remove unnecessary TODO for trailer keys allocation | |
HEAD is now at 67957fd... idna: use code generated by internal x/text package | |
~/go/src/github.com/weppos/publicsuffix-go | |
Error converting empty string: idna: invalid label "" | |
exit status 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"golang.org/x/net/idna" | |
) | |
func main() { | |
s, err := idna.ToASCII("") | |
if err != nil { | |
fmt.Printf("Error converting empty string: %v\n", err) | |
os.Exit(1) | |
} | |
fmt.Println("Empty string works!") | |
fmt.Printf("Result: `%v`\n", s) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ publicsuffix-go git:(master) ✗ cd ~/go/src/golang.org/x/net/idna; git co 69d4b8; cd -; | |
Previous HEAD position was 67957fd... idna: use code generated by internal x/text package | |
HEAD is now at 69d4b8a... http2: remove unnecessary TODO for trailer keys allocation | |
~/go/src/github.com/weppos/publicsuffix-go | |
➜ publicsuffix-go git:(master) ✗ go test ./... | |
? github.com/weppos/publicsuffix-go [no test files] | |
? github.com/weppos/publicsuffix-go/cmd/gen [no test files] | |
? github.com/weppos/publicsuffix-go/cmd/load [no test files] | |
ok github.com/weppos/publicsuffix-go/net/publicsuffix 0.023s | |
ok github.com/weppos/publicsuffix-go/publicsuffix 0.060s | |
➜ publicsuffix-go git:(master) ✗ cd ~/go/src/golang.org/x/net/idna; git co 67957f; cd -; | |
Previous HEAD position was 69d4b8a... http2: remove unnecessary TODO for trailer keys allocation | |
HEAD is now at 67957fd... idna: use code generated by internal x/text package | |
~/go/src/github.com/weppos/publicsuffix-go | |
➜ publicsuffix-go git:(master) ✗ go test ./... | |
? github.com/weppos/publicsuffix-go [no test files] | |
? github.com/weppos/publicsuffix-go/cmd/gen [no test files] | |
? github.com/weppos/publicsuffix-go/cmd/load [no test files] | |
ok github.com/weppos/publicsuffix-go/net/publicsuffix 0.037s | |
--- FAIL: TestPsl (0.02s) | |
psl_test.go:72: PSL(.example.com) should have returned error, got: example.com | |
psl_test.go:72: PSL(.example.example) should have returned error, got: example.example | |
--- FAIL: TestListFind (0.00s) | |
publicsuffix_test.go:247: Find(example.uk) = &{2 2 false}, want &{2 uk 2 false} | |
publicsuffix_test.go:247: Find(example.co.uk) = &{2 2 false}, want &{2 uk 2 false} | |
publicsuffix_test.go:247: Find(foo.example.co.uk) = &{2 2 false}, want &{2 uk 2 false} | |
publicsuffix_test.go:247: Find(british-library.uk) = &{2 2 false}, want &{3 british-library.uk 2 false} | |
publicsuffix_test.go:247: Find(foo.british-library.uk) = &{2 2 false}, want &{3 british-library.uk 2 false} | |
publicsuffix_test.go:247: Find(blogspot.com) = &{1 com 1 false}, want &{1 blogspot.com 2 true} | |
publicsuffix_test.go:247: Find(foo.blogspot.com) = &{1 com 1 false}, want &{1 blogspot.com 2 true} | |
FAIL | |
FAIL github.com/weppos/publicsuffix-go/publicsuffix 0.051s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment