diff options
Diffstat (limited to 'tests/c/temit.nim')
-rw-r--r-- | tests/c/temit.nim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/c/temit.nim b/tests/c/temit.nim new file mode 100644 index 000000000..1943c94ea --- /dev/null +++ b/tests/c/temit.nim @@ -0,0 +1,16 @@ +discard """ + output: "509" +""" +# Test the new ``emit`` pragma: + +{.emit: """ +#include <stdio.h> +static int cvariable = 420; + +""".} + +proc embedsC() = + var nimVar = 89 + {.emit: """printf("%d\n", cvariable + (int)`nimVar`);""".} + +embedsC() |