From 6e83a614f0c6e33ea662bf69a433b239600b6e17 Mon Sep 17 00:00:00 2001 From: "Crom (Thibaut CHARLES)" Date: Tue, 9 Dec 2014 11:45:55 +0100 Subject: [PATCH] Added unittests (not tested on windows platform) --- std/path.d | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/std/path.d b/std/path.d index 5cfa2a5c1..08ce8045f 100644 --- a/std/path.d +++ b/std/path.d @@ -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); }