From 57fdb18f5f8ebf3316a33ab9508d9d3934b723ce Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Sat, 7 Jul 2018 12:16:37 -0700 Subject: [PATCH] fixup --- lib/pure/os.nim | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 7849e152dfdec..613e048043f5f 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -303,17 +303,13 @@ proc absolutePath*(path: string, root = getCurrentDir()): string = doAssert absolutePath("a") == getCurrentDir() / "a" if isAbsolute(path): path else: - doAssert root.isAbsolute, root + if not root.isAbsolute: + # CHECKME: is that the correct exception type? + raise newException(ValueError, root) joinPath(root, path) when isMainModule: - # TODO: use doAssertRaises pending https://github.com/nim-lang/Nim/issues/8223 - try: - let a = absolutePath("a", "b") - doAssert false, "should've thrown" - except: - discard - + doAssertRaises(ValueError): discard absolutePath("a", "b") doAssert absolutePath("a") == getCurrentDir() / "a" doAssert absolutePath("a", "/b") == "/b" / "a" when defined(Posix):