mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Added unittests (not tested on windows platform)
This commit is contained in:
parent
5462585245
commit
6e83a614f0
1 changed files with 18 additions and 0 deletions
18
std/path.d
18
std/path.d
|
@ -1394,6 +1394,12 @@ unittest
|
||||||
{
|
{
|
||||||
assert (buildNormalizedPath("") is null);
|
assert (buildNormalizedPath("") is null);
|
||||||
assert (buildNormalizedPath("foo") == "foo");
|
assert (buildNormalizedPath("foo") == "foo");
|
||||||
|
assert (buildNormalizedPath(".") == ".");
|
||||||
|
assert (buildNormalizedPath(".", ".") == ".");
|
||||||
|
assert (buildNormalizedPath("foo", "..") == ".");
|
||||||
|
assert (buildNormalizedPath("", "") is null);
|
||||||
|
assert (buildNormalizedPath("", ".") == ".");
|
||||||
|
assert (buildNormalizedPath(".", "") == ".");
|
||||||
|
|
||||||
version (Posix)
|
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");
|
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)
|
else version (Windows)
|
||||||
{
|
{
|
||||||
|
@ -1462,6 +1474,12 @@ unittest
|
||||||
assert (buildNormalizedPath(`c:\foo`, `bar\baz\`) == `c:\foo\bar\baz`);
|
assert (buildNormalizedPath(`c:\foo`, `bar\baz\`) == `c:\foo\bar\baz`);
|
||||||
assert (buildNormalizedPath(`c:\foo`, `bar/..`) == `c:\foo`);
|
assert (buildNormalizedPath(`c:\foo`, `bar/..`) == `c:\foo`);
|
||||||
assert (buildNormalizedPath(`\\server\share\foo`, `..\bar`) == `\\server\share\bar`);
|
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);
|
else static assert (0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue