diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-05-06 11:53:22 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-05-06 11:53:22 +0200 |
commit | a3e0a7ebbb7682fa40643b1e876ff229e76ba740 (patch) | |
tree | a1084976e758c4aea4263b124e0dd563a54b362b /tests | |
parent | c22e0d414ddff0404a0adb1a8fc18d867e49ecd9 (diff) | |
parent | 78315792d33a26e519278aec650f76022f53082b (diff) | |
download | Nim-a3e0a7ebbb7682fa40643b1e876ff229e76ba740.tar.gz |
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'tests')
-rw-r--r-- | tests/collections/ttables.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/collections/ttables.nim b/tests/collections/ttables.nim index a2988e841..01dab44fc 100644 --- a/tests/collections/ttables.nim +++ b/tests/collections/ttables.nim @@ -235,6 +235,21 @@ block withKeyTest: except KeyError: discard +block takeTest: + var t = initTable[string, int]() + t["key"] = 123 + + var val = 0 + assert(t.take("key", val)) + assert(val == 123) + + val = -1 + assert(not t.take("key", val)) + assert(val == -1) + + assert(not t.take("otherkey", val)) + assert(val == -1) + proc orderedTableSortTest() = var t = initOrderedTable[string, int](2) for key, val in items(data): t[key] = val |