url_test.go (go1.19.src) | : | url_test.go (go1.19.1.src) | ||
---|---|---|---|---|
skipping to change at line 2085 | skipping to change at line 2085 | |||
elem: []string{"go"}, | elem: []string{"go"}, | |||
out: "https://go.googlesource.com/go", | out: "https://go.googlesource.com/go", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com/a/b/c", | base: "https://go.googlesource.com/a/b/c", | |||
elem: []string{"../../../go"}, | elem: []string{"../../../go"}, | |||
out: "https://go.googlesource.com/go", | out: "https://go.googlesource.com/go", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com/", | base: "https://go.googlesource.com/", | |||
elem: []string{"../go"}, | ||||
out: "https://go.googlesource.com/go", | ||||
}, | ||||
{ | ||||
base: "https://go.googlesource.com", | ||||
elem: []string{"../go"}, | ||||
out: "https://go.googlesource.com/go", | ||||
}, | ||||
{ | ||||
base: "https://go.googlesource.com", | ||||
elem: []string{"../go", "../../go", "../../../go"}, | ||||
out: "https://go.googlesource.com/go", | ||||
}, | ||||
{ | ||||
base: "https://go.googlesource.com/../go", | ||||
elem: nil, | ||||
out: "https://go.googlesource.com/go", | ||||
}, | ||||
{ | ||||
base: "https://go.googlesource.com/", | ||||
elem: []string{"./go"}, | elem: []string{"./go"}, | |||
out: "https://go.googlesource.com/go", | out: "https://go.googlesource.com/go", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com//", | base: "https://go.googlesource.com//", | |||
elem: []string{"/go"}, | elem: []string{"/go"}, | |||
out: "https://go.googlesource.com/go", | out: "https://go.googlesource.com/go", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com//", | base: "https://go.googlesource.com//", | |||
skipping to change at line 2115 | skipping to change at line 2135 | |||
out: "https://go.googlesource.com/go/", | out: "https://go.googlesource.com/go/", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com", | base: "https://go.googlesource.com", | |||
elem: []string{"go//"}, | elem: []string{"go//"}, | |||
out: "https://go.googlesource.com/go/", | out: "https://go.googlesource.com/go/", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com", | base: "https://go.googlesource.com", | |||
elem: nil, | elem: nil, | |||
out: "https://go.googlesource.com", | out: "https://go.googlesource.com/", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com/", | base: "https://go.googlesource.com/", | |||
elem: nil, | elem: nil, | |||
out: "https://go.googlesource.com/", | out: "https://go.googlesource.com/", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com/a%2fb", | base: "https://go.googlesource.com/a%2fb", | |||
elem: []string{"c"}, | elem: []string{"c"}, | |||
out: "https://go.googlesource.com/a%2fb/c", | out: "https://go.googlesource.com/a%2fb/c", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com/a%2fb", | base: "https://go.googlesource.com/a%2fb", | |||
elem: []string{"c%2fd"}, | elem: []string{"c%2fd"}, | |||
out: "https://go.googlesource.com/a%2fb/c%2fd", | out: "https://go.googlesource.com/a%2fb/c%2fd", | |||
}, | }, | |||
{ | { | |||
base: "https://go.googlesource.com/a/b", | ||||
elem: []string{"/go"}, | ||||
out: "https://go.googlesource.com/a/b/go", | ||||
}, | ||||
{ | ||||
base: "/", | base: "/", | |||
elem: nil, | elem: nil, | |||
out: "/", | out: "/", | |||
}, | }, | |||
{ | ||||
base: "a", | ||||
elem: nil, | ||||
out: "a", | ||||
}, | ||||
{ | ||||
base: "a", | ||||
elem: []string{"b"}, | ||||
out: "a/b", | ||||
}, | ||||
{ | ||||
base: "a", | ||||
elem: []string{"../b"}, | ||||
out: "b", | ||||
}, | ||||
{ | ||||
base: "a", | ||||
elem: []string{"../../b"}, | ||||
out: "b", | ||||
}, | ||||
{ | ||||
base: "", | ||||
elem: []string{"a"}, | ||||
out: "a", | ||||
}, | ||||
{ | ||||
base: "", | ||||
elem: []string{"../a"}, | ||||
out: "a", | ||||
}, | ||||
} | } | |||
for _, tt := range tests { | for _, tt := range tests { | |||
wantErr := "nil" | wantErr := "nil" | |||
if tt.out == "" { | if tt.out == "" { | |||
wantErr = "non-nil error" | wantErr = "non-nil error" | |||
} | } | |||
if out, err := JoinPath(tt.base, tt.elem...); out != tt.out || (e rr == nil) != (tt.out != "") { | if out, err := JoinPath(tt.base, tt.elem...); out != tt.out || (e rr == nil) != (tt.out != "") { | |||
t.Errorf("JoinPath(%q, %q) = %q, %v, want %q, %v", tt.bas e, tt.elem, out, err, tt.out, wantErr) | t.Errorf("JoinPath(%q, %q) = %q, %v, want %q, %v", tt.bas e, tt.elem, out, err, tt.out, wantErr) | |||
} | } | |||
var out string | var out string | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 56 lines changed or added |