OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package epfrontend | |
6 | |
7 import ( | |
8 "fmt" | |
9 "testing" | |
10 | |
11 . "github.com/smartystreets/goconvey/convey" | |
12 ) | |
13 | |
14 func TestSafeURLPathJoin(t *testing.T) { | |
15 Convey(`Testing safeURLPathJoin`, t, func() { | |
16 for _, e := range []struct { | |
17 parts []string | |
18 value string | |
19 }{ | |
20 {[]string{"foo", "bar", "baz"}, "foo/bar/baz"}, | |
21 {[]string{"", "foo", "bar", "baz", ""}, "/foo/bar/baz/"}
, | |
22 {[]string{"/", "/foo/", "/bar/", "//baz///"}, "/foo/bar/
baz"}, | |
23 {[]string{""}, ""}, | |
24 } { | |
25 Convey(fmt.Sprintf(`URL parts %v resolve to %q.`, e.part
s, e.value), func() { | |
26 So(safeURLPathJoin(e.parts...), ShouldEqual, e.v
alue) | |
27 }) | |
28 } | |
29 }) | |
30 } | |
OLD | NEW |