Skip to content

Commit 7be6b8d

Browse files
committed
Added changes suggested by code review.
The comment on using %q instead of %s in formatting strings in errors is also applicable to the output of TestSingleJoinSlash, so I took the liberty of fixing that also.
1 parent f67619d commit 7be6b8d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/net/http/httputil/reverseproxy_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ func TestSingleJoinSlash(t *testing.T) {
12021202
}
12031203
for _, tt := range tests {
12041204
if got := singleJoiningSlash(tt.slasha, tt.slashb); got != tt.expected {
1205-
t.Errorf("singleJoiningSlash(%s,%s) want %s got %s",
1205+
t.Errorf("singleJoiningSlash(%q,%q) want %q got %q",
12061206
tt.slasha,
12071207
tt.slashb,
12081208
tt.expected,
@@ -1213,10 +1213,10 @@ func TestSingleJoinSlash(t *testing.T) {
12131213

12141214
func TestJoinURLPath(t *testing.T) {
12151215
tests := []struct {
1216-
a *url.URL
1217-
b *url.URL
1218-
path string
1219-
rawpath string
1216+
a *url.URL
1217+
b *url.URL
1218+
wantPath string
1219+
wantRaw string
12201220
}{
12211221
{&url.URL{Path: "/a/b"}, &url.URL{Path: "/c"}, "/a/b/c", ""},
12221222
{&url.URL{Path: "/a/b", RawPath: "badpath"}, &url.URL{Path: "c"}, "/a/b/c", "/a/b/c"},
@@ -1228,11 +1228,11 @@ func TestJoinURLPath(t *testing.T) {
12281228

12291229
for _, tt := range tests {
12301230
p, rp := joinURLPath(tt.a, tt.b)
1231-
if p != tt.path || rp != tt.rawpath {
1232-
t.Errorf("joinURLPath(URL(%s,%s),URL(%s,%s)) want (%s,%s) got (%s,%s)",
1231+
if p != tt.wantPath || rp != tt.wantRaw {
1232+
t.Errorf("joinURLPath(URL(%q,%q),URL(%q,%q)) want (%q,%q) got (%q,%q)",
12331233
tt.a.Path, tt.a.RawPath,
12341234
tt.b.Path, tt.b.RawPath,
1235-
tt.path, tt.rawpath,
1235+
tt.wantPath, tt.wantRaw,
12361236
p, rp)
12371237
}
12381238
}

0 commit comments

Comments
 (0)