tester reports ignored tests and supports 'nimout'; fixes #2211

This commit is contained in:
Araq 2015-02-25 12:59:19 +01:00
commit 335c19c869
7 changed files with 48 additions and 10 deletions

View file

@ -1,16 +1,16 @@
discard """
disabled: true
nimout: '''void
int'''
"""
import macros, typetraits
import macros
macro checkType(ex, expected: expr): stmt {.immediate.} =
var t = ex.typ
assert t.name == expected.strVal
macro checkType(ex: stmt; expected: expr): stmt =
var t = ex.getType()
echo t
proc voidProc = echo "hello"
proc intProc(a, b): int = 10
proc intProc(a: int, b: float): int = 10
checkType(voidProc(), "void")
checkType(intProc(10, 20.0), "int")
checkType(noproc(10, 20.0), "Error Type")

View file

@ -1,6 +1,5 @@
discard """
output: "bla"
disabled: true
"""
import macros

View file

@ -1,3 +1,7 @@
discard """
disabled: true
"""
import macro_bug
type TObj = object

17
tests/macros/typesapi.nim Normal file
View file

@ -0,0 +1,17 @@
discard """
nimout: '''proc (x: int): string => typeDesc[proc[string, int]]
proc (x: int): void => typeDesc[proc[void, int]]
proc (x: int) => typeDesc[proc[void, int]]'''
"""
#2211
import macros
macro showType(t:stmt): stmt =
let ty = t.getType
echo t.repr, " => ", ty.repr
showType(proc(x:int): string)
showType(proc(x:int): void)
showType(proc(x:int))