Commit cc6feab3 authored by Stefan Baebler's avatar Stefan Baebler Committed by Filippo Valsorda

net/url: fail TestParseErrors test when getting an unwanted error

The TestParseErrors test function was not strict with unwanted errors
received from url.Parse(). It was not failing in such cases, now it does

Fixes #33646
Updates #29098

Change-Id: I069521093e2bff8b1fcd41ffd3f9799f3108bc61
GitHub-Last-Rev: e6844c57f979ddb8418643d9c5244a5d1b4578ba
GitHub-Pull-Request: golang/go#33876
Reviewed-on: https://go-review.googlesource.com/c/go/+/191966
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
parent 2b598944
...@@ -1429,16 +1429,16 @@ func TestParseErrors(t *testing.T) { ...@@ -1429,16 +1429,16 @@ func TestParseErrors(t *testing.T) {
{"http://[::1]/", false}, {"http://[::1]/", false},
{"http://[::1]a", true}, {"http://[::1]a", true},
{"http://[::1]%23", true}, {"http://[::1]%23", true},
{"http://[::1%25en0]", false}, // valid zone id {"http://[::1%25en0]", false}, // valid zone id
{"http://[::1]:", false}, // colon, but no port OK {"http://[::1]:", false}, // colon, but no port OK
{"http://x:", false}, // colon, but no port OK {"http://x:", false}, // colon, but no port OK
{"http://[::1]:%38%30", true}, // not allowed: % encoding only for non-ASCII {"http://[::1]:%38%30", true}, // not allowed: % encoding only for non-ASCII
{"http://[::1%25%41]", false}, // RFC 6874 allows over-escaping in zone {"http://[::1%25%41]", false}, // RFC 6874 allows over-escaping in zone
{"http://[%10::1]", true}, // no %xx escapes in IP address {"http://[%10::1]", true}, // no %xx escapes in IP address
{"http://[::1]/%48", false}, // %xx in path is fine {"http://[::1]/%48", false}, // %xx in path is fine
{"http://%41:8080/", true}, // not allowed: % encoding only for non-ASCII {"http://%41:8080/", true}, // not allowed: % encoding only for non-ASCII
{"mysql://x@y(z:123)/foo", false}, // golang.org/issue/12023 {"mysql://x@y(z:123)/foo", true}, // not well-formed per RFC 3986, golang.org/issue/33646
{"mysql://x@y(1.2.3.4:123)/foo", false}, {"mysql://x@y(1.2.3.4:123)/foo", true},
{"http://[]%20%48%54%54%50%2f%31%2e%31%0a%4d%79%48%65%61%64%65%72%3a%20%31%32%33%0a%0a/", true}, // golang.org/issue/11208 {"http://[]%20%48%54%54%50%2f%31%2e%31%0a%4d%79%48%65%61%64%65%72%3a%20%31%32%33%0a%0a/", true}, // golang.org/issue/11208
{"http://a b.com/", true}, // no space in host name please {"http://a b.com/", true}, // no space in host name please
...@@ -1456,7 +1456,7 @@ func TestParseErrors(t *testing.T) { ...@@ -1456,7 +1456,7 @@ func TestParseErrors(t *testing.T) {
continue continue
} }
if err != nil { if err != nil {
t.Logf("Parse(%q) = %v; want no error", tt.in, err) t.Errorf("Parse(%q) = %v; want no error", tt.in, err)
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment