tos.nim 635 B

12345678910111213141516171819202122
  1. # xxx consider merging this in tests/stdlib/tos.nim for increased coverage (with selecting disabling)
  2. static: doAssert defined(nodejs)
  3. import os
  4. block:
  5. doAssert "./foo//./bar/".normalizedPath == "foo/bar"
  6. doAssert relativePath(".//foo/bar", "foo") == "bar"
  7. doAssert "/".isAbsolute
  8. doAssert not "".isAbsolute
  9. doAssert not ".".isAbsolute
  10. doAssert not "foo".isAbsolute
  11. doAssert relativePath("", "bar") == ""
  12. doAssert normalizedPath(".///foo//./") == "foo"
  13. when nimvm: discard
  14. else:
  15. let cwd = getCurrentDir()
  16. doAssert cwd.isAbsolute
  17. doAssert relativePath(getCurrentDir() / "foo", "bar") == ".." / "foo"