Added Test for zip() with anonymous tuples.
This commit is contained in:
parent
b42c729da4
commit
a41778725a
1 changed files with 7 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
output: '''true'''
|
output: '''true'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashes, tables
|
import hashes, tables, sequtils
|
||||||
|
|
||||||
const
|
const
|
||||||
data = {
|
data = {
|
||||||
|
|
@ -103,9 +103,10 @@ block countTableTest1:
|
||||||
|
|
||||||
block SyntaxTest:
|
block SyntaxTest:
|
||||||
var x = newTable[int, string]({:})
|
var x = newTable[int, string]({:})
|
||||||
|
discard x
|
||||||
|
|
||||||
block nilTest:
|
block nilTest:
|
||||||
var i, j: PTable[int, int] = nil
|
var i, j: TableRef[int, int] = nil
|
||||||
assert i == j
|
assert i == j
|
||||||
j = newTable[int, int]()
|
j = newTable[int, int]()
|
||||||
assert i != j
|
assert i != j
|
||||||
|
|
@ -131,6 +132,10 @@ proc orderedTableSortTest() =
|
||||||
# check that insert still works:
|
# check that insert still works:
|
||||||
t["newKeyHere"] = 80
|
t["newKeyHere"] = 80
|
||||||
|
|
||||||
|
block anonZipTest:
|
||||||
|
let keys = @['a','b','c']
|
||||||
|
let values = @[1, 2, 3]
|
||||||
|
doAssert "{a: 1, b: 2, c: 3}" == $ toTable zip(keys, values)
|
||||||
|
|
||||||
orderedTableSortTest()
|
orderedTableSortTest()
|
||||||
echo "true"
|
echo "true"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue