relativePath("foo", "foo") is now ".", not "" (#13452)
This commit is contained in:
parent
1276e386fe
commit
a43583f9c8
6 changed files with 37 additions and 8 deletions
7
tests/js/tos.nim
Normal file
7
tests/js/tos.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
static: doAssert defined(nodejs)
|
||||
|
||||
import os
|
||||
|
||||
block:
|
||||
doAssert "./foo//./bar/".normalizedPath == "foo/bar"
|
||||
doAssert relativePath(".//foo/bar", "foo") == "bar"
|
||||
|
|
@ -329,15 +329,19 @@ block ospaths:
|
|||
doAssert relativePath("/Users/me/bar/z.nim", "/Users/me", '/') == "bar/z.nim"
|
||||
doAssert relativePath("", "/users/moo", '/') == ""
|
||||
doAssert relativePath("foo", "", '/') == "foo"
|
||||
doAssert relativePath("/foo", "/Foo", '/') == (when FileSystemCaseSensitive: "../foo" else: "")
|
||||
doAssert relativePath("/Foo", "/foo", '/') == (when FileSystemCaseSensitive: "../Foo" else: "")
|
||||
doAssert relativePath("/foo", "/fOO", '/') == (when FileSystemCaseSensitive: "../foo" else: "")
|
||||
doAssert relativePath("/foO", "/foo", '/') == (when FileSystemCaseSensitive: "../foO" else: "")
|
||||
doAssert relativePath("/foo", "/Foo", '/') == (when FileSystemCaseSensitive: "../foo" else: ".")
|
||||
doAssert relativePath("/Foo", "/foo", '/') == (when FileSystemCaseSensitive: "../Foo" else: ".")
|
||||
doAssert relativePath("/foo", "/fOO", '/') == (when FileSystemCaseSensitive: "../foo" else: ".")
|
||||
doAssert relativePath("/foO", "/foo", '/') == (when FileSystemCaseSensitive: "../foO" else: ".")
|
||||
|
||||
doAssert relativePath("foo", ".", '/') == "foo"
|
||||
doAssert relativePath(".", ".", '/') == "."
|
||||
doAssert relativePath("..", ".", '/') == ".."
|
||||
|
||||
doAssert relativePath("foo", "foo") == "."
|
||||
doAssert relativePath("", "foo") == ""
|
||||
doAssert relativePath("././/foo", "foo//./") == "."
|
||||
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -22,4 +22,7 @@ import unicode
|
|||
import uri
|
||||
import macros
|
||||
|
||||
block:
|
||||
doAssert "./foo//./bar/".normalizedPath == "foo/bar".unixToNativePath
|
||||
|
||||
echo "Nimscript imports are successful."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue