summary refs log tree commit diff stats
path: root/tests/msgs/texpandmacro.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/msgs/texpandmacro.nim')
-rw-r--r--tests/msgs/texpandmacro.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/msgs/texpandmacro.nim b/tests/msgs/texpandmacro.nim
new file mode 100644
index 000000000..fea8b571f
--- /dev/null
+++ b/tests/msgs/texpandmacro.nim
@@ -0,0 +1,18 @@
+discard """
+  cmd: "nim c --expandMacro:foo $file"
+  nimout: '''texpandmacro.nim(17, 1) 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