Skip to content

Commit

Permalink
[os] fix #10017 regression
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Dec 16, 2018
1 parent 0409f23 commit 14c8d31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/pure/pathnorm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,4 @@ proc normalizePath*(path: string; dirSep = DirSep): string =
result = newStringOfCap(path.len)
var state = 0
addNormalizePath(path, result, state, dirSep)
if result == "" and path != "": result = "."
7 changes: 5 additions & 2 deletions tests/stdlib/tos.nim
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,17 @@ block walkDirRec:
removeDir("walkdir_test")

block normalizedPath:
doAssert normalizedPath("") == ""
block relative:
doAssert normalizedPath(".") == ""
doAssert normalizedPath(".") == "."
doAssert normalizedPath("foo/..") == "."
doAssert normalizedPath("foo//../bar/.") == "bar"
doAssert normalizedPath("..") == ".."
doAssert normalizedPath("../") == ".."
doAssert normalizedPath("../..") == unixToNativePath"../.."
doAssert normalizedPath("../a/..") == ".."
doAssert normalizedPath("../a/../") == ".."
doAssert normalizedPath("./") == ""
doAssert normalizedPath("./") == "."

block absolute:
doAssert normalizedPath("/") == unixToNativePath"/"
Expand Down

0 comments on commit 14c8d31

Please sign in to comment.