the test suite is mostly green again

This commit is contained in:
Zahary Karadjov 2012-03-16 05:33:21 +02:00
commit 72f2a6e275
19 changed files with 46 additions and 67 deletions

View file

@ -1,8 +1,6 @@
from sdl import PSurface
discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34,
discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34,
32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xff000000'i32)

View file

@ -1,6 +1,6 @@
# Test if the new table constructor syntax works:
template ignoreExpr(e: expr): stmt =
template ignoreExpr(e: expr): stmt {.immediate.} =
nil
# test first class '..' syntactical citizen:

View file

@ -26,13 +26,13 @@ echo(ha)
# Test identifier generation:
template prefix(name: expr): expr = `"hu" name`
template prefix(name: expr): expr {.immediate.} = `"hu" name`
var `hu "XYZ"` = "yay"
echo prefix(XYZ)
template typedef(name: expr, typ: typeDesc) =
template typedef(name: expr, typ: typeDesc) {.immediate.} =
type
`T name`* = typ
`P name`* = ref `T name`

View file

@ -1,7 +1,7 @@
template `:=`(name, val: expr): stmt =
template `:=`(name, val: expr): stmt {.immediate.} =
var name = val
ha := 1 * 4
hu := "ta-da" == "ta-da"
echo ha, hu

View file

@ -3,10 +3,10 @@ discard """
line: 18
errormsg: "undeclared identifier: \'b\'"
"""
template declareInScope(x: expr, t: typeDesc): stmt =
template declareInScope(x: expr, t: typeDesc): stmt {.immediate.} =
var x: t
template declareInNewScope(x: expr, t: typeDesc): stmt =
template declareInNewScope(x: expr, t: typeDesc): stmt {.immediate.} =
# open a new scope:
block:
var x: t
@ -17,5 +17,3 @@ a = 42 # works, `a` is known here
declareInNewScope(b, int)
b = 42 #ERROR_MSG undeclared identifier: 'b'

View file

@ -1,4 +1,5 @@
discard """
disabled: true
output: '''derived class
base class
'''

View file

@ -1,5 +1,6 @@
discard """
output: '''derived class 2
disabled: true
output: '''derived class 2
base class
'''
"""

View file

@ -2,12 +2,12 @@ discard """
file: "tambsys.nim"
output: ""
"""
# Test ambiguous symbols
import mambsys1, mambsys2
var
v: mambsys1.TExport
mambsys2.foo(3) #OUT
# Test ambiguous symbols
import mambsys1, mambsys2
var
v: mambsys1.TExport
mambsys2.foo(3) #OUT

View file

@ -21,7 +21,7 @@ template Comparable(typ: typeDesc): stmt =
proc `<=` * (x, y: typ): bool {.borrow.}
proc `==` * (x, y: typ): bool {.borrow.}
template DefineCurrency(typ, base: expr): stmt =
template DefineCurrency(typ, base: expr): stmt {.immediate.} =
type
typ* = distinct base
Additive(typ)

View file

@ -6,7 +6,7 @@ discard """
var testNumber = 0
template test(opr, a, b, c: expr): stmt =
template test(opr, a, b, c: expr): stmt {.immediate.} =
# test the expression at compile and runtime
block:
const constExpr = opr(a, b)
@ -43,5 +43,3 @@ test(`shl`, 0xffffffff'i32, 0x4'i32, 0xfffffff0'i32)
Echo("Success") #OUT Success

View file

@ -2,7 +2,7 @@ discard """
output: "23456"
"""
template toSeq*(iter: expr): expr =
template toSeq*(iter: expr): expr {.immediate.} =
var result: seq[type(iter)] = @[]
for x in iter: add(result, x)
result