parent
b97a7dbf3d
commit
a98b1a7764
2 changed files with 88 additions and 49 deletions
|
|
@ -18,24 +18,47 @@ doAssert isAbsolute(unixToNativePath("/a/b", "a"))
|
|||
doAssert unixToNativePath("a/b") == joinPath("a", "b")
|
||||
|
||||
when defined(macos):
|
||||
doAssert unixToNativePath("./") == ":"
|
||||
doAssert unixToNativePath("./abc") == ":abc"
|
||||
doAssert unixToNativePath("../abc") == "::abc"
|
||||
doAssert unixToNativePath("../../abc") == ":::abc"
|
||||
doAssert unixToNativePath("/abc", "a") == "abc"
|
||||
doAssert unixToNativePath("/abc/def", "a") == "abc:def"
|
||||
doAssert unixToNativePath("./") == ":"
|
||||
doAssert unixToNativePath("./abc") == ":abc"
|
||||
doAssert unixToNativePath("../abc") == "::abc"
|
||||
doAssert unixToNativePath("../../abc") == ":::abc"
|
||||
doAssert unixToNativePath("/abc", "a") == "abc"
|
||||
doAssert unixToNativePath("/abc/def", "a") == "abc:def"
|
||||
elif doslikeFileSystem:
|
||||
doAssert unixToNativePath("./") == ".\\"
|
||||
doAssert unixToNativePath("./abc") == ".\\abc"
|
||||
doAssert unixToNativePath("../abc") == "..\\abc"
|
||||
doAssert unixToNativePath("../../abc") == "..\\..\\abc"
|
||||
doAssert unixToNativePath("/abc", "a") == "a:\\abc"
|
||||
doAssert unixToNativePath("/abc/def", "a") == "a:\\abc\\def"
|
||||
doAssert unixToNativePath("./") == ".\\"
|
||||
doAssert unixToNativePath("./abc") == ".\\abc"
|
||||
doAssert unixToNativePath("../abc") == "..\\abc"
|
||||
doAssert unixToNativePath("../../abc") == "..\\..\\abc"
|
||||
doAssert unixToNativePath("/abc", "a") == "a:\\abc"
|
||||
doAssert unixToNativePath("/abc/def", "a") == "a:\\abc\\def"
|
||||
else:
|
||||
#Tests for unix
|
||||
doAssert unixToNativePath("./") == "./"
|
||||
doAssert unixToNativePath("./abc") == "./abc"
|
||||
doAssert unixToNativePath("../abc") == "../abc"
|
||||
doAssert unixToNativePath("../../abc") == "../../abc"
|
||||
doAssert unixToNativePath("/abc", "a") == "/abc"
|
||||
doAssert unixToNativePath("/abc/def", "a") == "/abc/def"
|
||||
#Tests for unix
|
||||
doAssert unixToNativePath("./") == "./"
|
||||
doAssert unixToNativePath("./abc") == "./abc"
|
||||
doAssert unixToNativePath("../abc") == "../abc"
|
||||
doAssert unixToNativePath("../../abc") == "../../abc"
|
||||
doAssert unixToNativePath("/abc", "a") == "/abc"
|
||||
doAssert unixToNativePath("/abc/def", "a") == "/abc/def"
|
||||
|
||||
block extractFilenameTest:
|
||||
doAssert extractFilename("") == ""
|
||||
when defined(posix):
|
||||
doAssert extractFilename("foo/bar") == "bar"
|
||||
doAssert extractFilename("foo/bar.txt") == "bar.txt"
|
||||
doAssert extractFilename("foo/") == ""
|
||||
doAssert extractFilename("/") == ""
|
||||
when doslikeFileSystem:
|
||||
doAssert extractFilename(r"foo\bar") == "bar"
|
||||
doAssert extractFilename(r"foo\bar.txt") == "bar.txt"
|
||||
doAssert extractFilename(r"foo\") == ""
|
||||
doAssert extractFilename(r"C:\") == ""
|
||||
|
||||
block lastPathPartTest:
|
||||
doAssert lastPathPart("") == ""
|
||||
when defined(posix):
|
||||
doAssert lastPathPart("foo/bar.txt") == "bar.txt"
|
||||
doAssert lastPathPart("foo/") == "foo"
|
||||
doAssert lastPathPart("/") == ""
|
||||
when doslikeFileSystem:
|
||||
doAssert lastPathPart(r"foo\bar.txt") == "bar.txt"
|
||||
doAssert lastPathPart(r"foo\") == "foo"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue