diff options
| author | Robert Griesemer <gri@golang.org> | 2010-10-22 10:06:33 -0700 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2010-10-22 10:06:33 -0700 |
| commit | 3478891d1202c1324b096a61da2294dade732c63 (patch) | |
| tree | 73931a3378db0085bf5aa8d5fa512e70065a5f9a /src/pkg/path/path_test.go | |
| parent | f613015e0eeb9560579bf40dbdb40fac5e371bbc (diff) | |
| download | go-3478891d1202c1324b096a61da2294dade732c63.tar.xz | |
gofmt -s -w src misc
R=r, rsc
CC=golang-dev
https://golang.org/cl/2662041
Diffstat (limited to 'src/pkg/path/path_test.go')
| -rw-r--r-- | src/pkg/path/path_test.go | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/src/pkg/path/path_test.go b/src/pkg/path/path_test.go index 592e696b52..2bbb9244aa 100644 --- a/src/pkg/path/path_test.go +++ b/src/pkg/path/path_test.go @@ -15,52 +15,52 @@ type CleanTest struct { var cleantests = []CleanTest{ // Already clean - CleanTest{"", "."}, - CleanTest{"abc", "abc"}, - CleanTest{"abc/def", "abc/def"}, - CleanTest{"a/b/c", "a/b/c"}, - CleanTest{".", "."}, - CleanTest{"..", ".."}, - CleanTest{"../..", "../.."}, - CleanTest{"../../abc", "../../abc"}, - CleanTest{"/abc", "/abc"}, - CleanTest{"/", "/"}, + {"", "."}, + {"abc", "abc"}, + {"abc/def", "abc/def"}, + {"a/b/c", "a/b/c"}, + {".", "."}, + {"..", ".."}, + {"../..", "../.."}, + {"../../abc", "../../abc"}, + {"/abc", "/abc"}, + {"/", "/"}, // Remove trailing slash - CleanTest{"abc/", "abc"}, - CleanTest{"abc/def/", "abc/def"}, - CleanTest{"a/b/c/", "a/b/c"}, - CleanTest{"./", "."}, - CleanTest{"../", ".."}, - CleanTest{"../../", "../.."}, - CleanTest{"/abc/", "/abc"}, + {"abc/", "abc"}, + {"abc/def/", "abc/def"}, + {"a/b/c/", "a/b/c"}, + {"./", "."}, + {"../", ".."}, + {"../../", "../.."}, + {"/abc/", "/abc"}, // Remove doubled slash - CleanTest{"abc//def//ghi", "abc/def/ghi"}, - CleanTest{"//abc", "/abc"}, - CleanTest{"///abc", "/abc"}, - CleanTest{"//abc//", "/abc"}, - CleanTest{"abc//", "abc"}, + {"abc//def//ghi", "abc/def/ghi"}, + {"//abc", "/abc"}, + {"///abc", "/abc"}, + {"//abc//", "/abc"}, + {"abc//", "abc"}, // Remove . elements - CleanTest{"abc/./def", "abc/def"}, - CleanTest{"/./abc/def", "/abc/def"}, - CleanTest{"abc/.", "abc"}, + {"abc/./def", "abc/def"}, + {"/./abc/def", "/abc/def"}, + {"abc/.", "abc"}, // Remove .. elements - CleanTest{"abc/def/ghi/../jkl", "abc/def/jkl"}, - CleanTest{"abc/def/../ghi/../jkl", "abc/jkl"}, - CleanTest{"abc/def/..", "abc"}, - CleanTest{"abc/def/../..", "."}, - CleanTest{"/abc/def/../..", "/"}, - CleanTest{"abc/def/../../..", ".."}, - CleanTest{"/abc/def/../../..", "/"}, - CleanTest{"abc/def/../../../ghi/jkl/../../../mno", "../../mno"}, + {"abc/def/ghi/../jkl", "abc/def/jkl"}, + {"abc/def/../ghi/../jkl", "abc/jkl"}, + {"abc/def/..", "abc"}, + {"abc/def/../..", "."}, + {"/abc/def/../..", "/"}, + {"abc/def/../../..", ".."}, + {"/abc/def/../../..", "/"}, + {"abc/def/../../../ghi/jkl/../../../mno", "../../mno"}, // Combinations - CleanTest{"abc/./../def", "def"}, - CleanTest{"abc//./../def", "def"}, - CleanTest{"abc/../../././../def", "../../def"}, + {"abc/./../def", "def"}, + {"abc//./../def", "def"}, + {"abc/../../././../def", "../../def"}, } func TestClean(t *testing.T) { @@ -76,11 +76,11 @@ type SplitTest struct { } var splittests = []SplitTest{ - SplitTest{"a/b", "a/", "b"}, - SplitTest{"a/b/", "a/b/", ""}, - SplitTest{"a/", "a/", ""}, - SplitTest{"a", "", "a"}, - SplitTest{"/", "/", ""}, + {"a/b", "a/", "b"}, + {"a/b/", "a/b/", ""}, + {"a/", "a/", ""}, + {"a", "", "a"}, + {"/", "/", ""}, } func TestSplit(t *testing.T) { @@ -98,21 +98,21 @@ type JoinTest struct { var jointests = []JoinTest{ // zero parameters - JoinTest{[]string{}, ""}, + {[]string{}, ""}, // one parameter - JoinTest{[]string{""}, ""}, - JoinTest{[]string{"a"}, "a"}, + {[]string{""}, ""}, + {[]string{"a"}, "a"}, // two parameters - JoinTest{[]string{"a", "b"}, "a/b"}, - JoinTest{[]string{"a", ""}, "a"}, - JoinTest{[]string{"", "b"}, "b"}, - JoinTest{[]string{"/", "a"}, "/a"}, - JoinTest{[]string{"/", ""}, "/"}, - JoinTest{[]string{"a/", "b"}, "a/b"}, - JoinTest{[]string{"a/", ""}, "a"}, - JoinTest{[]string{"", ""}, ""}, + {[]string{"a", "b"}, "a/b"}, + {[]string{"a", ""}, "a"}, + {[]string{"", "b"}, "b"}, + {[]string{"/", "a"}, "/a"}, + {[]string{"/", ""}, "/"}, + {[]string{"a/", "b"}, "a/b"}, + {[]string{"a/", ""}, "a"}, + {[]string{"", ""}, ""}, } // join takes a []string and passes it to Join. @@ -134,11 +134,11 @@ type ExtTest struct { } var exttests = []ExtTest{ - ExtTest{"path.go", ".go"}, - ExtTest{"path.pb.go", ".go"}, - ExtTest{"a.dir/b", ""}, - ExtTest{"a.dir/b.go", ".go"}, - ExtTest{"a.dir/", ""}, + {"path.go", ".go"}, + {"path.pb.go", ".go"}, + {"a.dir/b", ""}, + {"a.dir/b.go", ".go"}, + {"a.dir/", ""}, } func TestExt(t *testing.T) { @@ -287,17 +287,17 @@ func TestWalk(t *testing.T) { var basetests = []CleanTest{ // Already clean - CleanTest{"", "."}, - CleanTest{".", "."}, - CleanTest{"/.", "."}, - CleanTest{"/", "/"}, - CleanTest{"////", "/"}, - CleanTest{"x/", "x"}, - CleanTest{"abc", "abc"}, - CleanTest{"abc/def", "def"}, - CleanTest{"a/b/.x", ".x"}, - CleanTest{"a/b/c.", "c."}, - CleanTest{"a/b/c.x", "c.x"}, + {"", "."}, + {".", "."}, + {"/.", "."}, + {"/", "/"}, + {"////", "/"}, + {"x/", "x"}, + {"abc", "abc"}, + {"abc/def", "def"}, + {"a/b/.x", ".x"}, + {"a/b/c.", "c."}, + {"a/b/c.x", "c.x"}, } func TestBase(t *testing.T) { @@ -314,14 +314,14 @@ type IsAbsTest struct { } var isAbsTests = []IsAbsTest{ - IsAbsTest{"", false}, - IsAbsTest{"/", true}, - IsAbsTest{"/usr/bin/gcc", true}, - IsAbsTest{"..", false}, - IsAbsTest{"/a/../bb", true}, - IsAbsTest{".", false}, - IsAbsTest{"./", false}, - IsAbsTest{"lala", false}, + {"", false}, + {"/", true}, + {"/usr/bin/gcc", true}, + {"..", false}, + {"/a/../bb", true}, + {".", false}, + {"./", false}, + {"lala", false}, } func TestIsAbs(t *testing.T) { |
