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,5 +1,5 @@
discard """
output: '''true'''
targets: "c js"
"""
import lists
@ -62,6 +62,22 @@ block DoublyLinkedRingTest1:
assert($L == "[]")
assert(4 notin L)
echo "true"
block tlistsToString:
block:
var l = initDoublyLinkedList[int]()
l.append(1)
l.append(2)
l.append(3)
doAssert $l == "[1, 2, 3]"
block:
var l = initDoublyLinkedList[string]()
l.append("1")
l.append("2")
l.append("3")
doAssert $l == """["1", "2", "3"]"""
block:
var l = initDoublyLinkedList[char]()
l.append('1')
l.append('2')
l.append('3')
doAssert $l == """['1', '2', '3']"""