summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-03-18 14:25:10 +0100
committerGitHub <noreply@github.com>2020-03-18 14:25:10 +0100
commit3f29911a9496d82c355b84e23d91e992c3ddfce5 (patch)
treee7636e4f073b40c74d873e1f203fc014497f0360 /tests
parented263e174e7f9a7bce1863dc57979c1a752d2e66 (diff)
downloadNim-3f29911a9496d82c355b84e23d91e992c3ddfce5.tar.gz
new feature: --staticBoundChecks:on to enforce static array index checking (#10965)
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/timportedobj.nim28
-rw-r--r--tests/notnil/tnotnil4.nim5
-rw-r--r--tests/parallel/tinvalid_array_bounds.nim4
-rw-r--r--tests/parallel/tuseafterdef.nim1
-rw-r--r--tests/tools/second.nim6
5 files changed, 23 insertions, 21 deletions
diff --git a/tests/arc/timportedobj.nim b/tests/arc/timportedobj.nim
index 82d7b4740..9a88a9468 100644
--- a/tests/arc/timportedobj.nim
+++ b/tests/arc/timportedobj.nim
@@ -1,14 +1,14 @@
-discard """

-  cmd: "nim c --gc:arc $file"

-  action: "compile"

-"""

-

-# bug #13269

-

-import posix

-proc foo*() =

-  var last = newSeq[Stat]()

-  var next = last

-  for i in 0..3:

-    last = next

-foo()

+discard """
+  cmd: "nim c --gc:arc $file"
+  action: "compile"
+"""
+
+# bug #13269
+
+import posix
+proc foo*() =
+  var last = newSeq[Stat]()
+  var next = last
+  for i in 0..3:
+    last = next
+foo()
diff --git a/tests/notnil/tnotnil4.nim b/tests/notnil/tnotnil4.nim
index 4fd169827..c5178f71b 100644
--- a/tests/notnil/tnotnil4.nim
+++ b/tests/notnil/tnotnil4.nim
@@ -10,8 +10,9 @@ proc check(a: TObj not nil) =
 proc doit() =
    var x : array[0..1, TObj]
 
-   if x[0] != nil:
-      check(x[0])
+   let y = x[0]
+   if y != nil:
+      check(y)
 
 doit()
 
diff --git a/tests/parallel/tinvalid_array_bounds.nim b/tests/parallel/tinvalid_array_bounds.nim
index 4c6065fd6..15bf526df 100644
--- a/tests/parallel/tinvalid_array_bounds.nim
+++ b/tests/parallel/tinvalid_array_bounds.nim
@@ -1,6 +1,6 @@
 discard """
-  errormsg: "can prove: i + 1 > 30"
-  line: 21
+  errormsg: "cannot prove (i)..(i) disjoint from (i + 1)..(i + 1)"
+  line: 20
 """
 
 import threadpool
diff --git a/tests/parallel/tuseafterdef.nim b/tests/parallel/tuseafterdef.nim
index 833c72a0a..f1ae6e923 100644
--- a/tests/parallel/tuseafterdef.nim
+++ b/tests/parallel/tuseafterdef.nim
@@ -1,6 +1,7 @@
 discard """
   errormsg: "(k)..(k) not disjoint from (k)..(k)"
   line: 23
+  action: compile
 """
 
 # bug #1597
diff --git a/tests/tools/second.nim b/tests/tools/second.nim
index 0dbe72adb..ee94af25f 100644
--- a/tests/tools/second.nim
+++ b/tests/tools/second.nim
@@ -1,3 +1,3 @@
-import tables

-

-let dataEx* = {1: 2, 3: 4}.toTable

+import tables
+
+let dataEx* = {1: 2, 3: 4}.toTable