diff options
Diffstat (limited to 'tests/stdlib/tstdlib_various.nim')
-rw-r--r-- | tests/stdlib/tstdlib_various.nim | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/tests/stdlib/tstdlib_various.nim b/tests/stdlib/tstdlib_various.nim index d1723df78..bac5018fa 100644 --- a/tests/stdlib/tstdlib_various.nim +++ b/tests/stdlib/tstdlib_various.nim @@ -1,4 +1,5 @@ discard """ +matrix: "--mm:refc" output: ''' abc def @@ -20,27 +21,20 @@ Hi Andreas! How do you feel, Rumpf? @[0, 2, 1] @[0, 1, 2] 055this should be the casehugh@["(", "+", " 1", " 2", ")"] -caught a crash! -caught a crash! -caught a crash! -caught a crash! -caught a crash! -caught a crash! [5] [4, 5] [3, 4, 5] [2, 3, 4, 5] [2, 3, 4, 5, 6] [1, 2, 3, 4, 5, 6] -true <h1><a href="http://force7.de/nim">Nim</a></h1> ''' """ import - critbits, sets, strutils, tables, random, algorithm, re, ropes, segfaults, - lists, parsesql, streams, os, htmlgen, xmltree, strtabs - + std/[critbits, sets, strutils, tables, random, algorithm, re, ropes, + segfaults, lists, parsesql, streams, os, htmlgen, xmltree, strtabs] +import std/[syncio, assertions] block tcritbits: var r: CritBitTree[void] @@ -60,15 +54,15 @@ block tcritbits: block testequivalence: - doAssert(toSet(@[1,2,3]) <= toSet(@[1,2,3,4]), "equivalent or subset") - doAssert(toSet(@[1,2,3]) <= toSet(@[1,2,3]), "equivalent or subset") - doAssert((not(toSet(@[1,2,3]) <= toSet(@[1,2]))), "equivalent or subset") - doAssert(toSet(@[1,2,3]) <= toSet(@[1,2,3,4]), "strict subset") - doAssert((not(toSet(@[1,2,3]) < toSet(@[1,2,3]))), "strict subset") - doAssert((not(toSet(@[1,2,3]) < toSet(@[1,2]))), "strict subset") - doAssert((not(toSet(@[1,2,3]) == toSet(@[1,2,3,4]))), "==") - doAssert(toSet(@[1,2,3]) == toSet(@[1,2,3]), "==") - doAssert((not(toSet(@[1,2,3]) == toSet(@[1,2]))), "==") + doAssert(toHashSet(@[1,2,3]) <= toHashSet(@[1,2,3,4]), "equivalent or subset") + doAssert(toHashSet(@[1,2,3]) <= toHashSet(@[1,2,3]), "equivalent or subset") + doAssert((not(toHashSet(@[1,2,3]) <= toHashSet(@[1,2]))), "equivalent or subset") + doAssert(toHashSet(@[1,2,3]) <= toHashSet(@[1,2,3,4]), "strict subset") + doAssert((not(toHashSet(@[1,2,3]) < toHashSet(@[1,2,3]))), "strict subset") + doAssert((not(toHashSet(@[1,2,3]) < toHashSet(@[1,2]))), "strict subset") + doAssert((not(toHashSet(@[1,2,3]) == toHashSet(@[1,2,3,4]))), "==") + doAssert(toHashSet(@[1,2,3]) == toHashSet(@[1,2,3]), "==") + doAssert((not(toHashSet(@[1,2,3]) == toHashSet(@[1,2]))), "==") @@ -161,18 +155,21 @@ block tropes: block tsegfaults: - proc main = - try: - var x: ptr int - echo x[] + when not defined(arm64): + var crashes = 0 + proc main = try: - raise newException(ValueError, "not a crash") - except ValueError: - discard - except NilAccessError: - echo "caught a crash!" - for i in 0..5: - main() + var x: ptr int + echo x[] + try: + raise newException(ValueError, "not a crash") + except ValueError: + discard + except NilAccessDefect: + inc crashes + for i in 0..5: + main() + assert crashes == 6 @@ -209,11 +206,7 @@ block tsplit2: s.add("#") s.add(w) - try: - discard "hello".split("") - echo "false" - except AssertionError: - echo "true" + doAssert "true".split("") == @["true"] |