diff options
Diffstat (limited to 'testament/lib/stdtest')
-rw-r--r-- | testament/lib/stdtest/specialpaths.nim | 28 | ||||
-rw-r--r-- | testament/lib/stdtest/unittest_light.nim | 6 |
2 files changed, 14 insertions, 20 deletions
diff --git a/testament/lib/stdtest/specialpaths.nim b/testament/lib/stdtest/specialpaths.nim index 3c8b2338c..23d4c16ca 100644 --- a/testament/lib/stdtest/specialpaths.nim +++ b/testament/lib/stdtest/specialpaths.nim @@ -1,5 +1,6 @@ #[ todo: move findNimStdLibCompileTime, findNimStdLib here +xxx: consider moving this to $nim/compiler/relpaths.nim to get relocatable paths ]# import os @@ -9,22 +10,17 @@ import os # This means the binaries they produce will embed hardcoded paths, which # isn't appropriate for some applications that need to be relocatable. -const sourcePath = currentSourcePath() - # robust way to derive other paths here - # We don't depend on PATH so this is robust to having multiple nim - # binaries - -const nimRootDir* = sourcePath.parentDir.parentDir.parentDir.parentDir - ## root of Nim repo - -const stdlibDir* = nimRootDir / "lib" - # todo: make nimeval.findNimStdLibCompileTime use this - -const systemPath* = stdlibDir / "system.nim" - -const buildDir* = nimRootDir / "build" - ## refs #10268: all testament generated files should go here to avoid - ## polluting .gitignore +const + sourcePath = currentSourcePath() + # robust way to derive other paths here + # We don't depend on PATH so this is robust to having multiple nim binaries + nimRootDir* = sourcePath.parentDir.parentDir.parentDir.parentDir ## root of Nim repo + stdlibDir* = nimRootDir / "lib" + systemPath* = stdlibDir / "system.nim" + testsDir* = nimRootDir / "tests" + buildDir* = nimRootDir / "build" + ## refs #10268: all testament generated files should go here to avoid + ## polluting .gitignore static: # sanity check diff --git a/testament/lib/stdtest/unittest_light.nim b/testament/lib/stdtest/unittest_light.nim index d9842b399..bf254c11f 100644 --- a/testament/lib/stdtest/unittest_light.nim +++ b/testament/lib/stdtest/unittest_light.nim @@ -1,5 +1,3 @@ -# note: consider merging tests/assert/testhelper.nim here. - proc mismatch*[T](lhs: T, rhs: T): string = ## Simplified version of `unittest.require` that satisfies a common use case, ## while avoiding pulling too many dependencies. On failure, diagnostic @@ -31,8 +29,8 @@ proc mismatch*[T](lhs: T, rhs: T): string = result.add "lhs[0..<i]:{" & replaceInvisible($lhs[ 0..<i]) & "}" -proc assertEquals*[T](lhs: T, rhs: T) = +proc assertEquals*[T](lhs: T, rhs: T, msg = "") = when false: # can be useful for debugging to see all that's fed to this. echo "----" & $lhs if lhs!=rhs: - doAssert false, mismatch(lhs, rhs) + doAssert false, mismatch(lhs, rhs) & "\n" & msg |