summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-05-24 18:55:09 +0300
committerGitHub <noreply@github.com>2023-05-24 17:55:09 +0200
commit4d6be458a00a642555e95055ff640daba59513f7 (patch)
tree72c5c98f26d6e75c98b1129642cf7e415a89266f /lib/pure
parentc7f25419149d6b4b0723f0ef177bbaad72d7bc3e (diff)
downloadNim-4d6be458a00a642555e95055ff640daba59513f7.tar.gz
js -r defines nodejs & program result undeclared if unavailable (#21849)
* js -r defines nodejs & program result undefined if unavailable

fixes #16985, fixes #16074

* fix

* add changelog too

* minor word change
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/unittest.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index 9dafa8f03..964fba0e4 100644
--- a/lib/pure/unittest.nim
+++ b/lib/pure/unittest.nim
@@ -519,6 +519,12 @@ proc exceptionTypeName(e: ref Exception): string {.inline.} =
   if e == nil: "<foreign exception>"
   else: $e.name
 
+when not declared(setProgramResult):
+  {.warning: "setProgramResult not available on platform, unittest will not" &
+    " give failing exit code on test failure".}
+  template setProgramResult(a: int) =
+    discard
+
 template test*(name, body) {.dirty.} =
   ## Define a single test case identified by `name`.
   ##