diff options
author | Araq <rumpf_a@web.de> | 2012-08-31 00:00:14 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-08-31 00:00:14 +0200 |
commit | b56df72a325e4991128d808dc6c9edade3d0f293 (patch) | |
tree | 25bffb026a4c1ec0ca5f3aeca8588f1601960462 /tests/run | |
parent | 1d14cb1ad8d4d98ea19daa2d5ab6ded59d58553a (diff) | |
download | Nim-b56df72a325e4991128d808dc6c9edade3d0f293.tar.gz |
made tests green again
Diffstat (limited to 'tests/run')
-rw-r--r-- | tests/run/tidgen.nim | 2 | ||||
-rwxr-xr-x | tests/run/tmacro2.nim | 1 | ||||
-rwxr-xr-x | tests/run/tmacros1.nim | 3 | ||||
-rwxr-xr-x | tests/run/toop1.nim | 3 | ||||
-rwxr-xr-x | tests/run/tquotewords.nim | 3 | ||||
-rw-r--r-- | tests/run/tstringinterp.nim | 2 | ||||
-rw-r--r-- | tests/run/tusingstatement.nim | 3 |
7 files changed, 12 insertions, 5 deletions
diff --git a/tests/run/tidgen.nim b/tests/run/tidgen.nim index 0e856dc19..2fe9e0f82 100644 --- a/tests/run/tidgen.nim +++ b/tests/run/tidgen.nim @@ -8,7 +8,7 @@ import macros var gid {.compileTime.} = 3 -macro genId(invokation: expr): expr = +macro genId(): expr = result = newIntLitNode(gid) inc gid diff --git a/tests/run/tmacro2.nim b/tests/run/tmacro2.nim index 6aa9bb57d..8515322d5 100755 --- a/tests/run/tmacro2.nim +++ b/tests/run/tmacro2.nim @@ -13,6 +13,7 @@ proc testBlock(): string {.compileTime.} = result = "ta-da" macro mac(n: expr): expr = + let n = callsite() expectKind(n, nnkCall) expectLen(n, 2) expectKind(n[1], nnkStrLit) diff --git a/tests/run/tmacros1.nim b/tests/run/tmacros1.nim index 8cf2a5aa7..a1bb29823 100755 --- a/tests/run/tmacros1.nim +++ b/tests/run/tmacros1.nim @@ -1,11 +1,12 @@ discard """ - output: "Got: 'nnkIntLit' hi" + output: "Got: 'nnkMacroStmt' hi" """ import macros, strutils macro outterMacro*(n: stmt): stmt = + let n = callsite() var j : string = "hi" proc innerProc(i: int): string = echo "Using arg ! " & n.repr diff --git a/tests/run/toop1.nim b/tests/run/toop1.nim index 017facc4c..350799f51 100755 --- a/tests/run/toop1.nim +++ b/tests/run/toop1.nim @@ -35,7 +35,8 @@ proc init(my: var TRectangle) = my.height = 10 my.draw = cast[proc (my: var TFigure) {.nimcall.}](drawRectangle) -macro `!` (n: expr): stmt = +macro `!` (n: expr): stmt {.immediate.} = + let n = callsite() result = newNimNode(nnkCall, n) var dot = newNimNode(nnkDotExpr, n) dot.add(n[1]) # obj diff --git a/tests/run/tquotewords.nim b/tests/run/tquotewords.nim index 81f30c9a9..76b8d8af7 100755 --- a/tests/run/tquotewords.nim +++ b/tests/run/tquotewords.nim @@ -6,7 +6,8 @@ discard """ import macros -macro quoteWords(n: expr): expr = +macro quoteWords(n: expr): expr {.immediate.} = + let n = callsite() result = newNimNode(nnkBracket, n) for i in 1..n.len-1: expectKind(n[i], nnkIdent) diff --git a/tests/run/tstringinterp.nim b/tests/run/tstringinterp.nim index 676e7ea1d..f030213e0 100644 --- a/tests/run/tstringinterp.nim +++ b/tests/run/tstringinterp.nim @@ -18,6 +18,7 @@ template ProcessInterpolations(e: expr) = of ikVar, ikExpr: addExpr(newCall("$", parseExpr(f.value))) macro formatStyleInterpolation(e: expr): expr = + let e = callsite() var formatString = "" arrayNode = newNimNode(nnkBracket) @@ -41,6 +42,7 @@ macro formatStyleInterpolation(e: expr): expr = result[2] = arrayNode macro concatStyleInterpolation(e: expr): expr = + let e = callsite() var args: seq[PNimrodNode] newSeq(args, 0) diff --git a/tests/run/tusingstatement.nim b/tests/run/tusingstatement.nim index ff81684a1..f5168dbf5 100644 --- a/tests/run/tusingstatement.nim +++ b/tests/run/tusingstatement.nim @@ -26,7 +26,8 @@ import # `opened` here could be an overloaded proc which any type can define. # A common practice can be returing an Optional[Resource] obj for which # `opened` is defined to `optional.hasValue` -macro using(e: expr): stmt = +macro using(e: expr): stmt {.immediate.} = + let e = callsite() if e.len != 2: error "Using statement: unexpected number of arguments. Got " & $e.len & ", expected: 1 or more variable assignments and a block" |