add test
This commit is contained in:
parent
9becb41e04
commit
1d16676dd6
1 changed files with 22 additions and 0 deletions
|
|
@ -174,3 +174,25 @@ type
|
|||
var foo: Something
|
||||
foo.cardinal = north
|
||||
doAssert foo.b.hasCustomPragma(thingy) == true
|
||||
|
||||
|
||||
proc myproc(s: string): int =
|
||||
{.thingy.}:
|
||||
s.len
|
||||
|
||||
doAssert myproc("123") == 3
|
||||
|
||||
let xx = compiles:
|
||||
proc myproc_bad(s: string): int =
|
||||
{.not_exist.}:
|
||||
s.len
|
||||
doAssert: xx == false
|
||||
|
||||
|
||||
macro checkSym(s: typed{nkSym}): untyped =
|
||||
let body = s.getImpl.body
|
||||
doAssert body[1].kind == nnkPragmaBlock
|
||||
doAssert body[1][0].kind == nnkPragma
|
||||
doAssert body[1][0][0] == bindSym"thingy"
|
||||
|
||||
checkSym(myproc)
|
||||
Loading…
Add table
Add a link
Reference in a new issue