7 qt "github.com/frankban/quicktest"
10 func TestTrailingPath(t *testing.T) {
12 test := func(parts []string, result string) {
13 unescaped, err := url.QueryUnescape(trailingPath(parts[0], parts[1:]))
14 if !c.Check(err, qt.IsNil) {
17 c.Check(unescaped, qt.Equals, result)
19 test([]string{"a_b-c", "d + e.f"}, "a_b-c/d + e.f")
20 test([]string{"a_1-b_c2", "d 3. (e, f).g"},
21 "a_1-b_c2/d 3. (e, f).g",
25 func TestTrailingPathForEmptyInfoName(t *testing.T) {
26 qt.Check(t, trailingPath("", []string{`ノ┬─┬ノ ︵ ( \o°o)\`}), qt.Equals, "%E3%83%8E%E2%94%AC%E2%94%80%E2%94%AC%E3%83%8E+%EF%B8%B5+%28+%5Co%C2%B0o%29%5C")
27 qt.Check(t, trailingPath("", []string{"hello", "world"}), qt.Equals, "hello/world")
28 qt.Check(t, trailingPath("war", []string{"and", "peace"}), qt.Equals, "war/and/peace")