diff options
Diffstat (limited to 'tests/misc/thallo.nim')
-rw-r--r-- | tests/misc/thallo.nim | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/misc/thallo.nim b/tests/misc/thallo.nim index 17e955f03..8dac56023 100644 --- a/tests/misc/thallo.nim +++ b/tests/misc/thallo.nim @@ -1,4 +1,8 @@ -# Hallo +discard """ +action: compile +""" + +# noted this seems to be an old test file designed for manual testing. import os, strutils, macros @@ -7,7 +11,7 @@ type TMyEnum = enum meA, meB, meC, meD -when isMainModule: +when true: {.hint: "this is the main file".} proc fac[T](x: T): T = @@ -15,7 +19,7 @@ proc fac[T](x: T): T = if x <= 1: return 1 else: return x.`*`(fac(x-1)) -macro macrotest(n: expr): stmt {.immediate.} = +macro macrotest(n: varargs[untyped]): untyped = let n = callsite() expectKind(n, nnkCall) expectMinLen(n, 2) @@ -24,7 +28,7 @@ macro macrotest(n: expr): stmt {.immediate.} = result.add(newCall("write", n[1], n[i])) result.add(newCall("writeLine", n[1], newStrLitNode(""))) -macro debug(n: expr): stmt {.immediate.} = +macro debug(n: untyped): untyped = let n = callsite() result = newNimNode(nnkStmtList, n) for i in 1..n.len-1: @@ -44,7 +48,6 @@ echo(["a", "b", "c", "d"].len) for x in items(["What's", "your", "name", "?", ]): echo(x) var `name` = readLine(stdin) -{.breakpoint.} echo("Hi " & thallo.name & "!\n") debug(name) @@ -80,6 +83,5 @@ for i in 2..6: for j in countdown(i+4, 2): echo(fac(i * j)) -when isMainModule: +when true: {.hint: "this is the main file".} - |