summary refs log tree commit diff stats
path: root/tests/stdlib/tglobs.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-07-16 22:54:47 -0700
committerGitHub <noreply@github.com>2021-07-17 07:54:47 +0200
commit923a1c6ea7d9f45b6389680717692690218228fb (patch)
tree0153da816e90e3b09b4937fe4233ecdbc2cbf13b /tests/stdlib/tglobs.nim
parent25efb5386293540b0542833625d3fb6e22f3cfbc (diff)
downloadNim-923a1c6ea7d9f45b6389680717692690218228fb.tar.gz
fix nativeToUnixPath (#18501)
Diffstat (limited to 'tests/stdlib/tglobs.nim')
-rw-r--r--tests/stdlib/tglobs.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/stdlib/tglobs.nim b/tests/stdlib/tglobs.nim
new file mode 100644
index 000000000..739a127f8
--- /dev/null
+++ b/tests/stdlib/tglobs.nim
@@ -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()