improve tests for collections (#16328)

* improve tests for collections

* remove remaining code blocks in deques.nim

* improve runnableExamples
This commit is contained in:
Timothee Cour 2020-12-12 00:33:29 -08:00 • committed by GitHub
commit b1c232aca1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 227 additions and 242 deletions

View file

@ -1,3 +1,7 @@
discard """
targets: "c js"
"""
import std/[sequtils,critbits]
template main =
@ -65,5 +69,19 @@ template main =
discard strings.containsOrIncl("foo", 3)
doAssert strings["foo"] == 3
block tcritbitsToString:
block:
var t: CritBitTree[int]
t["a"] = 1
doAssert $t == """{"a": 1}"""
block:
var t: CritBitTree[string]
t["a"] = "1"
doAssert $t == """{"a": "1"}"""
block:
var t: CritBitTree[char]
t["a"] = '1'
doAssert $t == """{"a": '1'}"""
main()
static: main()