Add cleanPath test data

This commit is contained in:
Adrian Setyadi 2019-09-06 22:07:00 +07:00
parent 4f721a42ea
commit 1b54ec9567
2 changed files with 12 additions and 0 deletions

View File

@ -116,7 +116,9 @@ func BenchmarkCleanPath(b *testing.B) {
"/abc/def/..", "/abc/def/../..", "/abc/def/..", "/abc/def/../..",
"/abc/def/../../..", "/abc/def/../../..", "/abc/def/../../..", "/abc/def/../../..",
"/abc/def/../../../ghi/jkl/../../../mno", "/abc/def/../../../ghi/jkl/../../../mno",
"abc/..def", "abc/./...", "abc/a../...", "abc/a..z",
"abc/./../def", "abc//./../def", "abc/../../././../def", "abc/./../def", "abc//./../def", "abc/../../././../def",
"abc/./../..def", "abc/../.../..def", "abc/.//../..def",
} }
for _, function := range functions { for _, function := range functions {

View File

@ -60,10 +60,20 @@ var cleanTests = []struct {
{"/abc/def/../../..", "/"}, {"/abc/def/../../..", "/"},
{"/abc/def/../../../ghi/jkl/../../../mno", "/mno"}, {"/abc/def/../../../ghi/jkl/../../../mno", "/mno"},
// Keep .. elements
{"abc/..def", "/abc/..def"},
{"abc/./...", "/abc/..."},
{"abc/a../...", "/abc/a../..."},
{"abc/a..z", "/abc/a..z"},
// Combinations // Combinations
{"abc/./../def", "/def"}, {"abc/./../def", "/def"},
{"abc//./../def", "/def"}, {"abc//./../def", "/def"},
{"abc/../../././../def", "/def"}, {"abc/../../././../def", "/def"},
{"abc/../../././../...", "/..."},
{"abc/./../..def", "/..def"},
{"abc/../.../..def", "/.../..def"},
{"abc/.//../..def", "/..def"},
} }
func TestPathClean(t *testing.T) { func TestPathClean(t *testing.T) {