summary refs log tree commit diff stats
path: root/tests/compilerfeatures
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-05-29 20:47:28 +0200
committerAraq <rumpf_a@web.de>2019-05-29 20:47:28 +0200
commit9ecb1aae80e73ef246d7f719753e8a68b6b01fa0 (patch)
treefaf1ba36594adc84c3034d7be6e38360f1fc117c /tests/compilerfeatures
parentdc5fa90b43471f8b341ce120b3d75766e928bd1d (diff)
downloadNim-9ecb1aae80e73ef246d7f719753e8a68b6b01fa0.tar.gz
new compiler feature: --expandMacro
Diffstat (limited to 'tests/compilerfeatures')
-rw-r--r--tests/compilerfeatures/texpandmacro.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/compilerfeatures/texpandmacro.nim b/tests/compilerfeatures/texpandmacro.nim
new file mode 100644
index 000000000..76b0263ae
--- /dev/null
+++ b/tests/compilerfeatures/texpandmacro.nim
@@ -0,0 +1,18 @@
+discard """
+  cmd: "nim c --expandMacro:foo $file"
+  nimout: '''Hint: expanded macro:
+echo ["injected echo"]
+var x = 4 [ExpandMacro]
+'''
+  output: '''injected echo'''
+"""
+
+import macros
+
+macro foo(x: untyped): untyped =
+  result = quote do:
+    echo "injected echo"
+    `x`
+
+foo:
+  var x = 4