From 62c113ebc7ba6fa1594b24158a6cc3e1170f4030 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Thu, 5 Mar 2020 15:31:22 +0100 Subject: fix #13579 joinPath("/foo/", "../a") is now /a (#13586) --- tests/stdlib/tos.nim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/stdlib') 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. -- cgit 1.4.1-2-gfad0