Added unittests (not tested on windows platform)

This commit is contained in:
Crom (Thibaut CHARLES) 2014-12-09 11:45:55 +01:00
parent 5462585245
commit 6e83a614f0

View file

@ -1394,6 +1394,12 @@ unittest
{
assert (buildNormalizedPath("") is null);
assert (buildNormalizedPath("foo") == "foo");
assert (buildNormalizedPath(".") == ".");
assert (buildNormalizedPath(".", ".") == ".");
assert (buildNormalizedPath("foo", "..") == ".");
assert (buildNormalizedPath("", "") is null);
assert (buildNormalizedPath("", ".") == ".");
assert (buildNormalizedPath(".", "") == ".");
version (Posix)
{
@ -1416,6 +1422,12 @@ unittest
assert (buildNormalizedPath("/foo", "/bar/..", "baz") == "/baz");
assert (buildNormalizedPath("foo/./bar", "../../", "../baz") == "../baz");
assert (buildNormalizedPath("/foo/./bar", "../../baz") == "/baz");
//Curent dir path
assert (buildNormalizedPath("./") == ".");
assert (buildNormalizedPath("././") == ".");
assert (buildNormalizedPath("./foo/..") == ".");
assert (buildNormalizedPath("foo/..") == ".");
}
else version (Windows)
{
@ -1462,6 +1474,12 @@ unittest
assert (buildNormalizedPath(`c:\foo`, `bar\baz\`) == `c:\foo\bar\baz`);
assert (buildNormalizedPath(`c:\foo`, `bar/..`) == `c:\foo`);
assert (buildNormalizedPath(`\\server\share\foo`, `..\bar`) == `\\server\share\bar`);
//Curent dir path
assert (buildNormalizedPath(".\\") == ".");
assert (buildNormalizedPath(".\\.\\") == ".");
assert (buildNormalizedPath(".\\foo\\..") == ".");
assert (buildNormalizedPath("foo\\..") == ".");
}
else static assert (0);
}