summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJasper Jenkins <jasper.vs.jenkins@gmail.com>2019-09-08 11:31:22 -0700
committerAndreas Rumpf <rumpf_a@web.de>2019-09-08 20:31:22 +0200
commite5139b066294d0411fc81d545cc921545d7d5d8e (patch)
tree051fb43c1c7ebce8ae64e81d5b411e436993baa1 /tests
parent18135cc194e5efece24271c2afb6f09c1311bda9 (diff)
downloadNim-e5139b066294d0411fc81d545cc921545d7d5d8e.tar.gz
error for NimNode index kind (#12154)
Diffstat (limited to 'tests')
-rw-r--r--tests/errmsgs/tnnodeadd.nim8
-rw-r--r--tests/errmsgs/tnnodeindex.nim8
-rw-r--r--tests/errmsgs/tnnodeindexkind.nim8
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/errmsgs/tnnodeadd.nim b/tests/errmsgs/tnnodeadd.nim
new file mode 100644
index 000000000..61921883e
--- /dev/null
+++ b/tests/errmsgs/tnnodeadd.nim
@@ -0,0 +1,8 @@
+discard """
+  errormsg: "cannot add to node kind: nnkInt8Lit"
+  line: 7
+"""
+import macros
+macro t(x: untyped): untyped =
+  x.add(newEmptyNode())
+t(38'i8)
diff --git a/tests/errmsgs/tnnodeindex.nim b/tests/errmsgs/tnnodeindex.nim
new file mode 100644
index 000000000..5e37e7977
--- /dev/null
+++ b/tests/errmsgs/tnnodeindex.nim
@@ -0,0 +1,8 @@
+discard """
+  errormsg: "index 5 not in 0 .. 2"
+  line: 7
+"""
+import macros
+macro t(x: untyped): untyped =
+  result = x[5]
+t([1, 2, 3])
diff --git a/tests/errmsgs/tnnodeindexkind.nim b/tests/errmsgs/tnnodeindexkind.nim
new file mode 100644
index 000000000..9ea045e66
--- /dev/null
+++ b/tests/errmsgs/tnnodeindexkind.nim
@@ -0,0 +1,8 @@
+discard """
+  errormsg: "cannot set child of node kind: nnkStrLit"
+  line: 7
+"""
+import macros
+macro t(x: untyped): untyped =
+  x[0] = newEmptyNode()
+t("abc")