]> Cypherpunks repositories - gostls13.git/commitdiff
path/filepath: add test case for rooted ".."
authorHan-Wen Nienhuys <hanwen@google.com>
Thu, 28 Jun 2012 16:46:44 +0000 (09:46 -0700)
committerRob Pike <r@golang.org>
Thu, 28 Jun 2012 16:46:44 +0000 (09:46 -0700)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6350047

src/pkg/path/filepath/path_test.go

index ec6af4db7e2ab2fa1f977ddf50d776d53eda047e..ef554dd7fa122c1cc8d44402159b26afb1de8b9c 100644 (file)
@@ -20,7 +20,6 @@ type PathTest struct {
 
 var cleantests = []PathTest{
        // Already clean
-       {"", "."},
        {"abc", "abc"},
        {"abc/def", "abc/def"},
        {"a/b/c", "a/b/c"},
@@ -31,6 +30,9 @@ var cleantests = []PathTest{
        {"/abc", "/abc"},
        {"/", "/"},
 
+       // Empty is current dir
+       {"", "."},
+
        // Remove trailing slash
        {"abc/", "abc"},
        {"abc/def/", "abc/def"},
@@ -61,6 +63,7 @@ var cleantests = []PathTest{
        {"abc/def/../../..", ".."},
        {"/abc/def/../../..", "/"},
        {"abc/def/../../../ghi/jkl/../../../mno", "../../mno"},
+       {"/../abc", "/abc"},
 
        // Combinations
        {"abc/./../def", "def"},