diff options
author | Tomohiro <gpuppur@gmail.com> | 2019-10-08 02:57:16 +0900 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-10-07 19:57:16 +0200 |
commit | 509f53b782273a2ee5e130a7f5e9c57f079cc93e (patch) | |
tree | aa8392c152fba76bf0317cac21b00c52d70e0bfd /tests | |
parent | f9d95fd6a71f949db5994369da96f1c42d40d2a7 (diff) | |
download | Nim-509f53b782273a2ee5e130a7f5e9c57f079cc93e.tar.gz |
On windows, os.relativePath returns path as is when roots are different (#12329)
* On windows, os.relativePath returns path as is when roots are different * Implement os.sameRoot without windows API * Fix compile error when compiling lib/nimhcr.nim * Fix compile error when compiling lib/nimhcr.nim on Windows
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib/tos.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/stdlib/tos.nim b/tests/stdlib/tos.nim index ab0cce8de..35ea34841 100644 --- a/tests/stdlib/tos.nim +++ b/tests/stdlib/tos.nim @@ -334,6 +334,21 @@ block ospaths: doAssert relativePath("/foo", "/fOO", '/') == (when FileSystemCaseSensitive: "../foo" else: "") doAssert relativePath("/foO", "/foo", '/') == (when FileSystemCaseSensitive: "../foO" else: "") + when doslikeFileSystem: + doAssert relativePath(r"c:\foo.nim", r"C:\") == r"foo.nim" + doAssert relativePath(r"c:\foo\bar\baz.nim", r"c:\foo") == r"bar\baz.nim" + doAssert relativePath(r"c:\foo\bar\baz.nim", r"d:\foo") == r"c:\foo\bar\baz.nim" + doAssert relativePath(r"\foo\baz.nim", r"\foo") == r"baz.nim" + doAssert relativePath(r"\foo\bar\baz.nim", r"\bar") == r"..\foo\bar\baz.nim" + doAssert relativePath(r"\\foo\bar\baz.nim", r"\\foo\bar") == r"baz.nim" + doAssert relativePath(r"\\foo\bar\baz.nim", r"\\foO\bar") == r"baz.nim" + doAssert relativePath(r"\\foo\bar\baz.nim", r"\\bar\bar") == r"\\foo\bar\baz.nim" + doAssert relativePath(r"\\foo\bar\baz.nim", r"\\foo\car") == r"\\foo\bar\baz.nim" + doAssert relativePath(r"\\foo\bar\baz.nim", r"\\goo\bar") == r"\\foo\bar\baz.nim" + doAssert relativePath(r"\\foo\bar\baz.nim", r"c:\") == r"\\foo\bar\baz.nim" + 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("", "lib") == "lib" doAssert joinPath("", "/lib") == unixToNativePath"/lib" |