diff options
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/thashes.nim | 2 | ||||
-rw-r--r-- | tests/stdlib/tjson.nim | 7 | ||||
-rw-r--r-- | tests/stdlib/tjsonmacro.nim | 6 | ||||
-rw-r--r-- | tests/stdlib/trandom.nim | 19 | ||||
-rw-r--r-- | tests/stdlib/tstrutils.nim | 18 | ||||
-rw-r--r-- | tests/stdlib/ttimes.nim | 2 |
6 files changed, 26 insertions, 28 deletions
diff --git a/tests/stdlib/thashes.nim b/tests/stdlib/thashes.nim index caae79213..526a2839f 100644 --- a/tests/stdlib/thashes.nim +++ b/tests/stdlib/thashes.nim @@ -1,5 +1,5 @@ discard """ - targets: "c cpp js" + matrix: "; --backend:cpp; --backend:js --jsbigint64:on; --backend:js --jsbigint64:off" """ import std/hashes diff --git a/tests/stdlib/tjson.nim b/tests/stdlib/tjson.nim index a60d45aab..691bedeaa 100644 --- a/tests/stdlib/tjson.nim +++ b/tests/stdlib/tjson.nim @@ -1,6 +1,5 @@ discard """ - matrix: "--mm:refc" - targets: "c cpp js" + matrix: "--mm:refc; --backend:cpp --mm:refc; --backend:js --jsbigint64:off; --backend:js --jsbigint64:on" """ @@ -9,6 +8,7 @@ Note: Macro tests are in tests/stdlib/tjsonmacro.nim ]# import std/[json,parsejson,strutils] +import std/private/jsutils from std/math import isNaN when not defined(js): import std/streams @@ -314,7 +314,8 @@ block: # bug #17383 else: testRoundtrip(int.high): "9223372036854775807" testRoundtrip(uint.high): "18446744073709551615" - when not defined(js): + whenJsNoBigInt64: discard + do: testRoundtrip(int64.high): "9223372036854775807" testRoundtrip(uint64.high): "18446744073709551615" diff --git a/tests/stdlib/tjsonmacro.nim b/tests/stdlib/tjsonmacro.nim index 9c1fa833d..f08c3946b 100644 --- a/tests/stdlib/tjsonmacro.nim +++ b/tests/stdlib/tjsonmacro.nim @@ -436,11 +436,7 @@ proc testJson() = block: let s = """{"a": 1, "b": 2}""" let t = parseJson(s).to(Table[string, int]) - when not defined(js): - # For some reason on the JS backend `{"b": 2, "a": 0}` is - # sometimes the value of `t`. This needs investigation. I can't - # reproduce it right now in an isolated test. - doAssert t["a"] == 1 + doAssert t["a"] == 1 doAssert t["b"] == 2 block: diff --git a/tests/stdlib/trandom.nim b/tests/stdlib/trandom.nim index ef71c3442..c35fc47da 100644 --- a/tests/stdlib/trandom.nim +++ b/tests/stdlib/trandom.nim @@ -1,9 +1,10 @@ discard """ joinable: false # to avoid messing with global rand state - targets: "c js" + matrix: "; --backend:js --jsbigint64:off; --backend:js --jsbigint64:on" """ import std/[assertions, formatfloat] import std/[random, math, stats, sets, tables] +import std/private/jsutils when not defined(js): import std/os @@ -208,8 +209,8 @@ block: # bug #16360 when withUint: test cast[uint](int.high) test cast[uint](int.high) + 1 - when not defined(js): - # pending bug #16411 + whenJsNoBigInt64: discard + do: test uint64.high test uint64.high - 1 test uint.high - 2 @@ -239,16 +240,12 @@ block: # bug #16296 test(int.low .. -1) test(int.low .. 1) test(int64.low .. 1'i64) - when not defined(js): - # pending bug #16411 - test(10'u64 .. uint64.high) + test(10'u64 .. uint64.high) block: # bug #17670 - when not defined(js): - # pending bug #16411 - type UInt48 = range[0'u64..2'u64^48-1] - let x = rand(UInt48) - doAssert x is UInt48 + type UInt48 = range[0'u64..2'u64^48-1] + let x = rand(UInt48) + doAssert x is UInt48 block: # bug #17898 # Checks whether `initRand()` generates unique states. diff --git a/tests/stdlib/tstrutils.nim b/tests/stdlib/tstrutils.nim index 4e88197ff..12b0c13b1 100644 --- a/tests/stdlib/tstrutils.nim +++ b/tests/stdlib/tstrutils.nim @@ -1,10 +1,11 @@ discard """ - targets: "c cpp js" + matrix: "; --backend:cpp; --backend:js --jsbigint64:off; --backend:js --jsbigint64:on" """ import std/strutils from stdtest/testutils import disableVm import std/assertions +import std/private/jsutils # xxx each instance of `disableVm` and `when not defined js:` should eventually be fixed template rejectParse(e) = @@ -509,7 +510,8 @@ template main() = block: # toHex doAssert(toHex(100i16, 32) == "00000000000000000000000000000064") doAssert(toHex(-100i16, 32) == "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9C") - when not defined js: + whenJsNoBigInt64: discard + do: doAssert(toHex(high(uint64)) == "FFFFFFFFFFFFFFFF") doAssert(toHex(high(uint64), 16) == "FFFFFFFFFFFFFFFF") doAssert(toHex(high(uint64), 32) == "0000000000000000FFFFFFFFFFFFFFFF") @@ -530,11 +532,12 @@ template main() = doAssert(spaces(0) == "") block: # toBin, toOct - block:# bug #11369 + whenJsNoBigInt64: # bug #11369 + discard + do: var num: int64 = -1 - when not defined js: - doAssert num.toBin(64) == "1111111111111111111111111111111111111111111111111111111111111111" - doAssert num.toOct(24) == "001777777777777777777777" + doAssert num.toBin(64) == "1111111111111111111111111111111111111111111111111111111111111111" + doAssert num.toOct(24) == "001777777777777777777777" block: # replace doAssert "oo".replace("", "abc") == "oo" @@ -741,7 +744,8 @@ bar block: # formatSize disableVm: - when not defined(js): + whenJsNoBigInt64: discard + do: doAssert formatSize((1'i64 shl 31) + (300'i64 shl 20)) == "2.293GiB" # <=== bug #8231 doAssert formatSize((2.234*1024*1024).int) == "2.234MiB" doAssert formatSize(4096) == "4KiB" diff --git a/tests/stdlib/ttimes.nim b/tests/stdlib/ttimes.nim index f6159d942..47d2efcf1 100644 --- a/tests/stdlib/ttimes.nim +++ b/tests/stdlib/ttimes.nim @@ -1,5 +1,5 @@ discard """ - targets: "c js" + matrix: "; --backend:js --jsbigint64:on; --backend:js --jsbigint64:off" """ import times, strutils, unittest |