mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 05:23:20 +00:00
adopt tests
This commit is contained in:
committed by
Andreas Rumpf
parent
16353c2ac8
commit
77a0f3768b
@@ -21,7 +21,7 @@ ttmpl(1)
|
||||
ttmpl[int](1) #<- crash case #1
|
||||
|
||||
tproc[int]()
|
||||
discard tproc[int]
|
||||
let _ = tproc[int]
|
||||
ttmpl[int]() #<- crash case #2
|
||||
ttmpl[int] #<- crash case #3
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
msg: '''"muhaha"
|
||||
proc poo(x, y: int) =
|
||||
let y = x
|
||||
let y = x
|
||||
echo ["poo"]'''
|
||||
"""
|
||||
|
||||
@@ -16,14 +16,13 @@ proc poo(x, y: int) =
|
||||
|
||||
macro m(x: typed): untyped =
|
||||
echo repr x.getImpl
|
||||
result = x
|
||||
|
||||
discard m foo
|
||||
discard m poo
|
||||
m(foo)
|
||||
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:
|
||||
of 0: x
|
||||
of 1: x.getImpl.body[0][0][0]
|
||||
@@ -32,11 +31,11 @@ macro checkOwner(x: typed, check_id: static[int]): untyped =
|
||||
else: x
|
||||
result = newStrLitNode($sym.owner.symKind)
|
||||
|
||||
macro isSameOwner(x, y: typed): untyped =
|
||||
result =
|
||||
macro isSameOwner(x, y: typed): untyped =
|
||||
result =
|
||||
if x.owner == y.owner: bindSym"true"
|
||||
else: bindSym"false"
|
||||
|
||||
|
||||
|
||||
static:
|
||||
doAssert checkOwner(foo, 0) == "nskModule"
|
||||
|
||||
@@ -10,7 +10,7 @@ import times as bar3 except convert
|
||||
import definitions as baz
|
||||
|
||||
discard foo.v
|
||||
discard bar.now
|
||||
discard bar2.now
|
||||
discard bar3.now
|
||||
discard baz.v
|
||||
discard bar.now()
|
||||
discard bar2.now()
|
||||
discard bar3.now()
|
||||
discard baz.v
|
||||
|
||||
Reference in New Issue
Block a user