summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testament/tshouldfail.nim2
-rw-r--r--tests/vm/tslow_tables.nim31
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/testament/tshouldfail.nim b/tests/testament/tshouldfail.nim
index 64f4b3838..aca73c308 100644
--- a/tests/testament/tshouldfail.nim
+++ b/tests/testament/tshouldfail.nim
@@ -27,5 +27,7 @@ FAIL: tests/shouldfail/toutputsub.nim C
 Failure: reOutputsDiffer
 FAIL: tests/shouldfail/tsortoutput.nim C
 Failure: reOutputsDiffer
+FAIL: tests/shouldfail/ttimeout.nim C
+Failure: reTimeout
 '''
 """
diff --git a/tests/vm/tslow_tables.nim b/tests/vm/tslow_tables.nim
new file mode 100644
index 000000000..7ee523a87
--- /dev/null
+++ b/tests/vm/tslow_tables.nim
@@ -0,0 +1,31 @@
+discard """
+  timeout: "4"
+  action: "compile"
+  nimout: '''create
+search
+done'''
+"""
+
+# bug #12195
+
+import tables
+
+type Flop = object
+  a: int
+  #array[128, int]  # <-- compile time is proportional to array size
+
+proc hop(): bool =
+  var v: Table[int, Flop]
+
+  echo "create"
+  for i in 1..1000:
+    v.add i, Flop()
+
+  echo "search"
+  for i in 1..1000:
+    discard contains(v, i)
+
+  echo "done"
+
+const r = hop()
+