summary refs log tree commit diff stats
path: root/tests/collections
diff options
context:
space:
mode:
authornarimiran <narimiran@disroot.org>2020-10-28 08:57:52 +0100
committerAndreas Rumpf <rumpf_a@web.de>2020-10-28 10:20:18 +0100
commit732ddc02da9b6203e402d246078827d525434e6b (patch)
tree977c676d15065a3b14987a15761bf7c71f0735bc /tests/collections
parentb13fb9ddb869d46a6bcc5d9f8cb6576be17c3f22 (diff)
downloadNim-732ddc02da9b6203e402d246078827d525434e6b.tar.gz
change/remove deprecated stuff
Diffstat (limited to 'tests/collections')
-rw-r--r--tests/collections/ttables.nim28
1 files changed, 5 insertions, 23 deletions
diff --git a/tests/collections/ttables.nim b/tests/collections/ttables.nim
index 4d94b3d95..338a83fed 100644
--- a/tests/collections/ttables.nim
+++ b/tests/collections/ttables.nim
@@ -23,7 +23,7 @@ block tableadds:
   proc main =
     var tab = newTable[string, string]()
     for i in 0..1000:
-      tab.add "key", "value " & $i
+      tab["key"] = "value " & $i
 
   main()
   echo "done tableadds"
@@ -133,8 +133,8 @@ block tindexby:
   doAssert indexBy(newSeq[int](), proc(x: int):int = x) == initTable[int, int](), "empty int table"
 
   var tbl1 = initTable[int, int]()
-  tbl1.add(1,1)
-  tbl1.add(2,2)
+  tbl1[1] = 1
+  tbl1[2] = 2
   doAssert indexBy(@[1,2], proc(x: int):int = x) == tbl1, "int table"
 
   type
@@ -147,8 +147,8 @@ block tindexby:
     elem2 = TElem(foo: 2, bar: "baz")
 
   var tbl2 = initTable[string, TElem]()
-  tbl2.add("bar", elem1)
-  tbl2.add("baz", elem2)
+  tbl2["bar"] = elem1
+  tbl2["baz"] = elem2
   doAssert indexBy(@[elem1,elem2], proc(x: TElem): string = x.bar) == tbl2, "element table"
 
 
@@ -197,24 +197,6 @@ block ttables2:
   run1()
   echo "2"
 
-block allValues:
-  var t: Table[int, string]
-  var key = 0
-  let n = 1000
-  for i in 0..<n: t.add(i, $i)
-  const keys = [0, -1, 12]
-  for i in 0..1:
-    for key in keys:
-      t.add(key, $key & ":" & $i)
-  for i in 0..<n:
-    if i notin keys:
-      t.del(i)
-  doAssert t.sortedPairs == @[(-1, "-1:0"), (-1, "-1:1"), (0, "0"), (0, "0:0"), (0, "0:1"), (12, "12"), (12, "12:0"), (12, "12:1")]
-  doAssert sortedItems(t.allValues(0)) == @["0", "0:0", "0:1"]
-  doAssert sortedItems(t.allValues(-1)) == @["-1:0", "-1:1"]
-  doAssert sortedItems(t.allValues(12)) == @["12", "12:0", "12:1"]
-  doAssert sortedItems(t.allValues(1)) == @[]
-
 block tablesref:
   const
     data = {