fix test failure
This commit is contained in:
parent
8fbe3b3b7d
commit
fc7df3283c
2 changed files with 5 additions and 2 deletions
|
|
@ -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", "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue