summary refs log tree commit diff stats
path: root/tests/system/tdollars.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/system/tdollars.nim')
-rw-r--r--tests/system/tdollars.nim19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/system/tdollars.nim b/tests/system/tdollars.nim
index 93fa5cb9e..eabee81b3 100644
--- a/tests/system/tdollars.nim
+++ b/tests/system/tdollars.nim
@@ -1,5 +1,5 @@
 discard """
-  targets: "c cpp js"
+  matrix: "--mm:refc; --mm:orc; --backend:cpp; --backend:js --jsbigint64:off -d:nimStringHash2; --backend:js --jsbigint64:on"
 """
 
 #[
@@ -12,6 +12,7 @@ duplication (which always results in weaker test coverage in practice).
 ]#
 
 import std/unittest
+import std/private/jsutils
 template test[T](a: T, expected: string) =
   check $a == expected
   var b = a
@@ -44,8 +45,7 @@ block: # `$`(SomeInteger)
 
   check $int8.low == "-128"
   check $int8(-128) == "-128"
-  when not defined js: # pending https://github.com/nim-lang/Nim/issues/14127
-    check $cast[int8](-128) == "-128"
+  check $cast[int8](-128) == "-128"
 
   var a = 12345'u16
   check $a == "12345"
@@ -66,7 +66,8 @@ block: # `$`(SomeInteger)
   testType int
   testType bool
 
-  when not defined(js): # requires BigInt support
+  whenJsNoBigInt64: discard
+  do:
     testType uint64
     testType int64
     testType BiggestInt
@@ -108,10 +109,10 @@ block:
     # if `uint8(a1)` changes meaning to `cast[uint8](a1)` in future, update this test;
     # until then, this is the correct semantics.
     let a3 = $a2
-    doAssert a2 < 3
-    doAssert a3 == "-1"
+    doAssert a2 == 255'u8
+    doAssert a3 == "255"
     proc intToStr(a: uint8): cstring {.importjs: "(# + \"\")".}
-    doAssert $intToStr(a2) == "-1"
+    doAssert $intToStr(a2) == "255"
   else:
     block:
       let x = -1'i8
@@ -176,10 +177,10 @@ proc main()=
       res.addInt int64(i)
     doAssert res == "-9-8-7-6-5-4-3-2-10"
 
-    when not defined(js):
+    whenJsNoBigInt64: discard
+    do:
       test2 high(int64), "9223372036854775807"
       test2 low(int64), "-9223372036854775808"
-
     test2 high(int32), "2147483647"
     test2 low(int32), "-2147483648"
     test2 high(int16), "32767"