From 1d16676dd6a31de03bfc87a5dfdee482b27b51b5 Mon Sep 17 00:00:00 2001 From: Andrii Riabushenko Date: Tue, 11 Dec 2018 23:53:59 +0000 Subject: add test --- tests/pragmas/tcustom_pragma.nim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/pragmas') diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim index ae0f39631..0bc4d2f18 100644 --- a/tests/pragmas/tcustom_pragma.nim +++ b/tests/pragmas/tcustom_pragma.nim @@ -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) \ No newline at end of file -- cgit 1.4.1-2-gfad0 r, Nim's stdlib, tools, and documentation. (mirror)ahoang <ahoang@tilde.institute>
summary refs log blame commit diff stats
path: root/tools/niminst/debcreation.nim
blob: 60aa48639506b0ea10765f6ec1250e1714ee734d (plain) (tree)
1
2
3
4
5
6
7
8
9