diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-02-26 02:25:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 11:25:27 +0100 |
commit | 0c312ad898f793d9b095197d26074e6fd7f3328d (patch) | |
tree | b3f33ed1692d24a32b5669f2f590d905497e04b6 /tests/stdlib | |
parent | 11db28bc617b2c2280401980051898fd8bf58190 (diff) | |
download | Nim-0c312ad898f793d9b095197d26074e6fd7f3328d.tar.gz |
fix #13455 ; joinPath(a,b) now honors trailing slashes in b (or a if b = "") (#13467)
* fix #13455 ; joinPath(a,b) now honors trailing slashes in b (or a if b = "") * fix test windows
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/tos.nim | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/stdlib/tos.nim b/tests/stdlib/tos.nim index 15b82fadf..c649749e3 100644 --- a/tests/stdlib/tos.nim +++ b/tests/stdlib/tos.nim @@ -357,14 +357,37 @@ block ospaths: doAssert relativePath(r"\\foo\bar\baz.nim", r"\foo") == r"\\foo\bar\baz.nim" doAssert relativePath(r"c:\foo.nim", r"\foo") == r"c:\foo.nim" - doAssert joinPath("usr", "") == unixToNativePath"usr/" + doAssert joinPath("usr", "") == unixToNativePath"usr" doAssert joinPath("", "lib") == "lib" doAssert joinPath("", "/lib") == unixToNativePath"/lib" doAssert joinPath("usr/", "/lib") == unixToNativePath"usr/lib" - doAssert joinPath("", "") == unixToNativePath"" - doAssert joinPath("/" / "") == unixToNativePath"/" + doAssert joinPath("", "") == unixToNativePath"" # issue #13455 + doAssert joinPath("", "/") == unixToNativePath"/" + doAssert joinPath("/", "/") == unixToNativePath"/" + doAssert joinPath("/", "") == unixToNativePath"/" + doAssert joinPath("/" / "") == unixToNativePath"/" # weird test case... doAssert joinPath("/", "/a/b/c") == unixToNativePath"/a/b/c" doAssert joinPath("foo/","") == unixToNativePath"foo/" + doAssert joinPath("foo/","abc") == unixToNativePath"foo/abc" + doAssert joinPath("foo//./","abc/.//") == unixToNativePath"foo/abc/" + doAssert joinPath("foo","abc") == unixToNativePath"foo/abc" + doAssert joinPath("","abc") == unixToNativePath"abc" + + doAssert joinPath("gook/.","abc") == unixToNativePath"gook/abc" + + # controversial: inconsistent with `joinPath("gook/.","abc")` + # on linux, `./foo` and `foo` are treated a bit differently for executables + # but not `./foo/bar` and `foo/bar` + doAssert joinPath(".", "/lib") == unixToNativePath"./lib" + doAssert joinPath(".","abc") == unixToNativePath"./abc" + + # cases related to issue #13455 + doAssert joinPath("foo", "", "") == "foo" + doAssert joinPath("foo", "") == "foo" + doAssert joinPath("foo/", "") == unixToNativePath"foo/" + doAssert joinPath("foo/", ".") == "foo" + doAssert joinPath("foo", "./") == unixToNativePath"foo/" + doAssert joinPath("foo", "", "bar/") == unixToNativePath"foo/bar/" block getTempDir: block TMPDIR: |