summary refs log tree commit diff stats
path: root/tests/pragmas/tcustom_pragma.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-12-12 16:29:46 +0100
committerGitHub <noreply@github.com>2018-12-12 16:29:46 +0100
commita1bf9fd2b6525e613899c5dc0380fb80021ee3e7 (patch)
treed2bdb332c973d2f6d43391369229cc732642c74d /tests/pragmas/tcustom_pragma.nim
parenta38f35359738534ba856d02f3564d5fbc2dfc822 (diff)
parent070bcf4cea28a3238089379f5884787b2084b2de (diff)
downloadNim-a1bf9fd2b6525e613899c5dc0380fb80021ee3e7.tar.gz
Merge branch 'devel' into sorted_deduplicate
Diffstat (limited to 'tests/pragmas/tcustom_pragma.nim')
-rw-r--r--tests/pragmas/tcustom_pragma.nim22
1 files changed, 22 insertions, 0 deletions
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