summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-06-06 18:03:51 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-06-06 18:03:51 +0200
commit210955c3b6bfbb1d27c426f78cd9315bab2dd0ec (patch)
tree03b37268667ee2db75ba0fffcb3b3954301f8586 /tests
parent0915399b5008eeec9ea8f3dbf0122c98f2055de7 (diff)
parentf603e1b268659085b8b9e51d55e78217bfe2e3c3 (diff)
downloadNim-210955c3b6bfbb1d27c426f78cd9315bab2dd0ec.tar.gz
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'tests')
-rw-r--r--tests/arithm/tshr.nim2
-rw-r--r--tests/stdlib/torderedtable.nim18
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/arithm/tshr.nim b/tests/arithm/tshr.nim
index 09e6e570c..e9b72f1df 100644
--- a/tests/arithm/tshr.nim
+++ b/tests/arithm/tshr.nim
@@ -16,3 +16,5 @@ proc T() =
 
 
 T()
+static:
+    T()
diff --git a/tests/stdlib/torderedtable.nim b/tests/stdlib/torderedtable.nim
new file mode 100644
index 000000000..91a916930
--- /dev/null
+++ b/tests/stdlib/torderedtable.nim
@@ -0,0 +1,18 @@
+import tables, random
+var t = initOrderedTable[int,string]()
+
+# this tests issue #5917
+var data = newSeq[int]()
+for i in 0..<1000:
+  var x = random(1000)
+  if x notin t: data.add(x)
+  t[x] = "meh"
+
+# this checks that keys are re-inserted
+# in order when table is enlarged.
+var i = 0
+for k, v in t:
+  doAssert(k == data[i])
+  doAssert(v == "meh")
+  inc(i)
+