summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-03-05 15:31:22 +0100
committerGitHub <noreply@github.com>2020-03-05 15:31:22 +0100
commit62c113ebc7ba6fa1594b24158a6cc3e1170f4030 (patch)
tree37ef86b89836406c30799d91534c1bba9afc20e2 /tests/stdlib
parent357edd86b429dfaa3c24dedabdad0eb68915616f (diff)
downloadNim-62c113ebc7ba6fa1594b24158a6cc3e1170f4030.tar.gz
fix #13579 joinPath("/foo/", "../a") is now /a (#13586)
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tos.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/stdlib/tos.nim b/tests/stdlib/tos.nim
index c649749e3..d713bfe0c 100644
--- a/tests/stdlib/tos.nim
+++ b/tests/stdlib/tos.nim
@@ -389,6 +389,19 @@ block ospaths:
   doAssert joinPath("foo", "./") == unixToNativePath"foo/"
   doAssert joinPath("foo", "", "bar/") == unixToNativePath"foo/bar/"
 
+  # issue #13579
+  doAssert joinPath("/foo", "../a") == unixToNativePath"/a"
+  doAssert joinPath("/foo/", "../a") == unixToNativePath"/a"
+  doAssert joinPath("/foo/.", "../a") == unixToNativePath"/a"
+  doAssert joinPath("/foo/.b", "../a") == unixToNativePath"/foo/a"
+  doAssert joinPath("/foo///", "..//a/") == unixToNativePath"/a/"
+  doAssert joinPath("foo/", "../a") == unixToNativePath"a"
+
+  when doslikeFileSystem:
+    doAssert joinPath("C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\", "..\\..\\VC\\vcvarsall.bat") == r"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
+    doAssert joinPath("C:\\foo", "..\\a") == r"C:\a"
+    doAssert joinPath("C:\\foo\\", "..\\a") == r"C:\a"
+
 block getTempDir:
   block TMPDIR:
     # TMPDIR env var is not used if either of these are defined.