diff options
author | Araq <rumpf_a@web.de> | 2012-09-12 21:48:37 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-09-12 21:48:37 +0200 |
commit | a59abdf8e4d0c85fbcf2b039c46dc98030ffc460 (patch) | |
tree | 5e4eeb69d3fe050833f3abf7d398de9034a3faa2 /tests | |
parent | 8178cd4fab0968c1d808b6d3cf56c30c3db7fb37 (diff) | |
download | Nim-a59abdf8e4d0c85fbcf2b039c46dc98030ffc460.tar.gz |
made more tests green; fixes #201
Diffstat (limited to 'tests')
-rw-r--r-- | tests/compile/tgeneric3.nim | 4 | ||||
-rw-r--r-- | tests/compile/tgenerictmpl.nim | 6 | ||||
-rw-r--r-- | tests/run/tgensym.nim (renamed from tests/compile/tgensym.nim) | 8 | ||||
-rwxr-xr-x | tests/run/tmacro3.nim | 4 | ||||
-rwxr-xr-x | tests/run/tmacro4.nim | 2 | ||||
-rwxr-xr-x | tests/run/tmacros1.nim | 2 | ||||
-rwxr-xr-x | tests/run/tsets2.nim | 2 |
7 files changed, 18 insertions, 10 deletions
diff --git a/tests/compile/tgeneric3.nim b/tests/compile/tgeneric3.nim index f4ec59ced..3c543ecfa 100644 --- a/tests/compile/tgeneric3.nim +++ b/tests/compile/tgeneric3.nim @@ -66,12 +66,12 @@ proc setItem[T,D] (AKey: T, AValue: D, ANode: PNode[T,D]): ref TItem[T,D] {.inli proc cmp[T:Int8|Int16|Int32|Int64|Int] (a,b: T): T {.inline.} = return a-b -template binSearchImpl *(docmp: expr) = +template binSearchImpl *(docmp: expr) {.immediate.} = var bFound = false result = 0 var H = haystack.len -1 while result <= H : - var I = (result + H) shr 1 + var I {.inject.} = (result + H) shr 1 var SW = docmp if SW < 0: result = I + 1 else: diff --git a/tests/compile/tgenerictmpl.nim b/tests/compile/tgenerictmpl.nim index f3bb4b6ee..a749e6570 100644 --- a/tests/compile/tgenerictmpl.nim +++ b/tests/compile/tgenerictmpl.nim @@ -1,8 +1,12 @@ template tmp[T](x: var seq[T]) = - var yz: T + #var yz: T # XXX doesn't work yet x = @[1, 2, 3] +macro tmp2[T](x: var seq[T]): stmt = + nil + var y: seq[int] tmp(y) +tmp(y) echo y.repr diff --git a/tests/compile/tgensym.nim b/tests/run/tgensym.nim index 3c0405136..3c85b0b83 100644 --- a/tests/compile/tgensym.nim +++ b/tests/run/tgensym.nim @@ -1,6 +1,10 @@ +discard """ + output: "123100" +""" + template hygienic(val: expr) = - var `*x` = val - stdout.write `*x` + var x = val + stdout.write x var x = 100 diff --git a/tests/run/tmacro3.nim b/tests/run/tmacro3.nim index fa2040e92..162212326 100755 --- a/tests/run/tmacro3.nim +++ b/tests/run/tmacro3.nim @@ -8,7 +8,7 @@ type TA = tuple[a: int] PA = ref TA -macro test*(a: stmt): stmt = +macro test*(a: stmt): stmt {.immediate.} = var val: PA new(val) val.a = 4 @@ -16,7 +16,7 @@ macro test*(a: stmt): stmt = test: "hi" -macro test2*(a: stmt): stmt = +macro test2*(a: stmt): stmt {.immediate.} = proc testproc(recurse: int) = echo "Thats weird" var o : PNimrodNode = nil diff --git a/tests/run/tmacro4.nim b/tests/run/tmacro4.nim index f90a8a434..10a23b159 100755 --- a/tests/run/tmacro4.nim +++ b/tests/run/tmacro4.nim @@ -5,7 +5,7 @@ discard """ import macros, strutils -macro test_macro*(n: stmt): stmt = +macro test_macro*(n: stmt): stmt {.immediate.} = result = newNimNode(nnkStmtList) var ass : PNimrodNode = newNimNode(nnkAsgn) add(ass, newIdentNode("str")) diff --git a/tests/run/tmacros1.nim b/tests/run/tmacros1.nim index a1bb29823..b2fb7240d 100755 --- a/tests/run/tmacros1.nim +++ b/tests/run/tmacros1.nim @@ -5,7 +5,7 @@ discard """ import macros, strutils -macro outterMacro*(n: stmt): stmt = +macro outterMacro*(n: stmt): stmt {.immediate.} = let n = callsite() var j : string = "hi" proc innerProc(i: int): string = diff --git a/tests/run/tsets2.nim b/tests/run/tsets2.nim index 89935072f..ac977096b 100755 --- a/tests/run/tsets2.nim +++ b/tests/run/tsets2.nim @@ -1,6 +1,6 @@ discard """ output: '''true''' - cmd: "nimrod cc --gc:none --hints:on $# $#" + cmd: "nimrod cc --hints:on $# $#" """ import hashes, sets |