fix nativeToUnixPath (#18501)

This commit is contained in:
Timothee Cour 2021-07-16 22:54:47 -07:00 • committed by GitHub
commit 923a1c6ea7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 3 deletions

20
tests/stdlib/tglobs.nim Normal file
View file

@ -0,0 +1,20 @@
import std/private/globs
template main =
when defined(windows):
doAssert nativeToUnixPath("C:") == "/C"
doAssert nativeToUnixPath(r"D:\") == "/D/"
doAssert nativeToUnixPath(r"E:\a") == "/E/a"
doAssert nativeToUnixPath(r"E:\a1\") == "/E/a1/"
doAssert nativeToUnixPath(r"E:\a1\bc") == "/E/a1/bc"
doAssert nativeToUnixPath(r"\a1\bc") == "/a1/bc"
doAssert nativeToUnixPath(r"a1\bc") == "a1/bc"
doAssert nativeToUnixPath("a1") == "a1"
doAssert nativeToUnixPath("") == ""
doAssert nativeToUnixPath(".") == "."
doAssert nativeToUnixPath("..") == ".."
doAssert nativeToUnixPath(r"..\") == "../"
doAssert nativeToUnixPath(r"..\..\.\") == "../.././"
static: main()
main()