fix #14475; unittest.require now works with nim c; require and check now works with -d:nodejs (#14676)

* fix #14475; make unittest work with -d:nodejs

* fixup

* fixup

* disable inim, delaunay which failed after unittest.require got fixed

* re-enable tests that have been fixed
This commit is contained in:
Timothee Cour 2020-07-14 04:14:32 -07:00 • committed by GitHub
commit e07d661d16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 55 additions and 13 deletions

View file

@ -63,3 +63,25 @@ proc addExitProc*(cl: proc() {.noconv.}) =
withLock gFunsLock:
fun()
gFuns.add Fun(kind: kNoconv, fun2: cl)
when not defined(nimscript):
proc getProgramResult*(): int =
when defined(js) and defined(nodejs):
asm """
`result` = process.exitCode;
"""
elif not defined(js):
result = programResult
else:
doAssert false
proc setProgramResult*(a: int) =
# pending https://github.com/nim-lang/Nim/issues/14674
when defined(js) and defined(nodejs):
asm """
process.exitCode = `a`;
"""
elif not defined(js):
programResult = a
else:
doAssert false