summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-09-17 10:42:07 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-09-17 15:15:12 +0200
commitc9f3a8b269ffbe52ee843ba350faf569d99e8106 (patch)
tree7b95fe20fcf2357286970bd5beb817056827ec99 /tests
parentf1b7c0494edbe8e2a6c6eb4764354bbfd6703bf1 (diff)
downloadNim-c9f3a8b269ffbe52ee843ba350faf569d99e8106.tar.gz
added a testcase for #12195; testament now supports a 'timeout' spec field
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()
+