Fixed FilePath behavior with trailing slash.

This commit is contained in:
Branimir Karadžić
2017-11-16 22:31:24 -08:00
parent 4dbcbc2167
commit 0c1354aacc
2 changed files with 22 additions and 10 deletions

View File

@@ -26,21 +26,21 @@ FilePathTest s_filePathTest[] =
{"/abc", "/abc"},
{"/", "/"},
// Remove trailing slash
{"abc/", "abc"},
{"abc/def/", "abc/def"},
{"a/b/c/", "a/b/c"},
{"./", "."},
{"../", ".."},
{"../../", "../.."},
{"/abc/", "/abc"},
// Do not remove trailing slash
{"abc/", "abc/"},
{"abc/def/", "abc/def/"},
{"a/b/c/", "a/b/c/"},
{"./", "./"},
{"../", "../"},
{"../../", "../../"},
{"/abc/", "/abc/"},
// Remove doubled slash
{"abc//def//ghi", "abc/def/ghi"},
{"//abc", "/abc"},
{"///abc", "/abc"},
{"//abc//", "/abc"},
{"abc//", "abc"},
{"//abc//", "/abc/"},
{"abc//", "abc/"},
// Remove . elements
{"abc/./def", "abc/def"},
@@ -84,6 +84,8 @@ static const FilePathSplit s_filePathSplit[] =
{ "tmp/archive.tar.gz", false, "tmp/", "archive.tar.gz", "archive", ".tar.gz" },
{ "/tmp/archive.tar.gz", true, "/tmp/", "archive.tar.gz", "archive", ".tar.gz" },
{ "d:/tmp/archive.tar.gz", true, "D:/tmp/", "archive.tar.gz", "archive", ".tar.gz" },
{ "/tmp/abv/gd", true, "/tmp/abv/", "gd", "gd", "" },
{ "/tmp/abv/gd/", true, "/tmp/abv/gd/", "", "", "" },
};
TEST_CASE("FilePath", "")