diff options
author | Araq <rumpf_a@web.de> | 2019-05-29 20:47:28 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-05-29 20:47:28 +0200 |
commit | 9ecb1aae80e73ef246d7f719753e8a68b6b01fa0 (patch) | |
tree | faf1ba36594adc84c3034d7be6e38360f1fc117c /tests/compilerfeatures | |
parent | dc5fa90b43471f8b341ce120b3d75766e928bd1d (diff) | |
download | Nim-9ecb1aae80e73ef246d7f719753e8a68b6b01fa0.tar.gz |
new compiler feature: --expandMacro
Diffstat (limited to 'tests/compilerfeatures')
-rw-r--r-- | tests/compilerfeatures/texpandmacro.nim | 18 |
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 |