summary refs log tree commit diff stats
path: root/tests/compilerfeatures/texpandmacro.nim
blob: 76b0263ae3d13e4be971e01aa27ec39b33461659 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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