mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
fix test failure
This commit is contained in:
@@ -349,10 +349,12 @@ proc splitFile*(path: string): tuple[dir, name, ext: string] {.
|
||||
## If `path` has no extension, `ext` is the empty string.
|
||||
## If `path` has no directory component, `dir` is the empty string.
|
||||
## If `path` has no filename component, `name` and `ext` are empty strings.
|
||||
if path.len == 0 or path[^1] in {DirSep, AltSep}:
|
||||
if path.len == 0:
|
||||
result = ("", "", "")
|
||||
elif path[^1] in {DirSep, AltSep}:
|
||||
if path.len == 1:
|
||||
# issue #8255
|
||||
result = (path[0 .. ^1], "", "")
|
||||
result = ($path[0], "", "")
|
||||
else:
|
||||
result = (path[0 ..< ^1], "", "")
|
||||
else:
|
||||
|
||||
@@ -240,6 +240,7 @@ block absolutePath:
|
||||
doAssert absolutePath("/a", "b/") == "/a"
|
||||
|
||||
block splitFile:
|
||||
doAssert splitFile("") == ("", "", "")
|
||||
doAssert splitFile("abc/") == ("abc", "", "")
|
||||
doAssert splitFile("/") == ("/", "", "")
|
||||
doAssert splitFile("./abc") == (".", "abc", "")
|
||||
|
||||
Reference in New Issue
Block a user