summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-11-12 02:36:59 +0100
committerAraq <rumpf_a@web.de>2014-11-12 02:36:59 +0100
commitb2f577df23d5daae873df18ff345965f8dc7e47b (patch)
tree2307ab50c5aa1c3cd2f7d56dfda817bcf05a3da1 /tests/macros
parent2d43fcafe0cedd4f78611dddccc31e1bef432aab (diff)
downloadNim-b2f577df23d5daae873df18ff345965f8dc7e47b.tar.gz
fixes #1473
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/ttryparseexpr.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/macros/ttryparseexpr.nim b/tests/macros/ttryparseexpr.nim
new file mode 100644
index 000000000..2a6f4437d
--- /dev/null
+++ b/tests/macros/ttryparseexpr.nim
@@ -0,0 +1,17 @@
+discard """
+  outputsub: '''Error: invalid indentation'''
+"""
+
+# feature request #1473
+import macros
+
+macro test(text: string): expr =
+  try:
+    result = parseExpr(text.strVal)
+  except ValueError:
+    result = newLit getCurrentExceptionMsg()
+
+const
+  a = test("foo&&")
+
+echo a