diff options
Diffstat (limited to 'tests/compile/ttempl3.nim')
-rwxr-xr-x | tests/compile/ttempl3.nim | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/compile/ttempl3.nim b/tests/compile/ttempl3.nim index a2e95ab03..361d11f6e 100755 --- a/tests/compile/ttempl3.nim +++ b/tests/compile/ttempl3.nim @@ -1,7 +1,8 @@ template withOpenFile(f: expr, filename: string, mode: TFileMode, - actions: stmt): stmt = + actions: stmt): stmt {.immediate.} = block: + # test that 'f' is implicitely 'injecting': var f: TFile if open(f, filename, mode): try: @@ -15,11 +16,11 @@ withOpenFile(txt, "ttempl3.txt", fmWrite): writeln(txt, "line 1") txt.writeln("line 2") -# Test zero argument template: -template ha: expr = myVar[0] - var myVar: array[0..1, int] + +# Test zero argument template: +template ha: expr = myVar[0] ha = 1 echo(ha) @@ -32,7 +33,7 @@ var `hu "XYZ"` = "yay" echo prefix(XYZ) -template typedef(name: expr, typ: typeDesc) {.immediate.} = +template typedef(name: expr, typ: typeDesc) {.immediate, dirty.} = type `T name`* = typ `P name`* = ref `T name` |