summary refs log tree commit diff stats
path: root/tests/macros/tmemit.nim
blob: e5aed31724ded5a0e3616f1340160cfb96002cc1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
discard """
  output: '''HELLO WORLD
c_func'''
"""

import macros, strutils

emit("echo " & '"' & "hello world".toUpper & '"')

# bug #1025

macro foo(icname): stmt =
  let ic = newStrLitNode($icname)
  result = quote do:
    proc x* =
      proc private {.exportc: `ic`.} = discard
      echo `ic`
      private()

foo(c_func)
x()