adopt tests

This commit is contained in:
Arne Döring 2018-11-08 18:40:15 +01:00 • committed by Andreas Rumpf
commit 77a0f3768b
3 changed files with 12 additions and 13 deletions

View file

@ -21,7 +21,7 @@ ttmpl(1)
ttmpl[int](1) #<- crash case #1 ttmpl[int](1) #<- crash case #1
tproc[int]() tproc[int]()
discard tproc[int] let _ = tproc[int]
ttmpl[int]() #<- crash case #2 ttmpl[int]() #<- crash case #2
ttmpl[int] #<- crash case #3 ttmpl[int] #<- crash case #3

View file

@ -1,7 +1,7 @@
discard """ discard """
msg: '''"muhaha" msg: '''"muhaha"
proc poo(x, y: int) = proc poo(x, y: int) =
let y = x let y = x
echo ["poo"]''' echo ["poo"]'''
""" """
@ -16,14 +16,13 @@ proc poo(x, y: int) =
macro m(x: typed): untyped = macro m(x: typed): untyped =
echo repr x.getImpl echo repr x.getImpl
result = x
discard m foo m(foo)
discard m poo m(poo)
#------------ #------------
macro checkOwner(x: typed, check_id: static[int]): untyped = macro checkOwner(x: typed, check_id: static[int]): untyped =
let sym = case check_id: let sym = case check_id:
of 0: x of 0: x
of 1: x.getImpl.body[0][0][0] of 1: x.getImpl.body[0][0][0]
@ -32,11 +31,11 @@ macro checkOwner(x: typed, check_id: static[int]): untyped =
else: x else: x
result = newStrLitNode($sym.owner.symKind) result = newStrLitNode($sym.owner.symKind)
macro isSameOwner(x, y: typed): untyped = macro isSameOwner(x, y: typed): untyped =
result = result =
if x.owner == y.owner: bindSym"true" if x.owner == y.owner: bindSym"true"
else: bindSym"false" else: bindSym"false"
static: static:
doAssert checkOwner(foo, 0) == "nskModule" doAssert checkOwner(foo, 0) == "nskModule"

View file

@ -10,7 +10,7 @@ import times as bar3 except convert
import definitions as baz import definitions as baz
discard foo.v discard foo.v
discard bar.now discard bar.now()
discard bar2.now discard bar2.now()
discard bar3.now discard bar3.now()
discard baz.v discard baz.v