summary refs log tree commit diff stats
path: root/tests/pragmas
diff options
context:
space:
mode:
authorIco Doornekamp <github@zevv.nl>2019-01-18 09:04:12 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-01-18 09:04:12 +0100
commitf11f36e7d5c2dc9a8f13f84ead360369fb05eaf3 (patch)
tree966c7fe81713c1ceb718f8fe1328887075eb59ee /tests/pragmas
parent27e2ed4375c21b196f5fd403c2199c63dcdb8bf0 (diff)
downloadNim-f11f36e7d5c2dc9a8f13f84ead360369fb05eaf3.tar.gz
Fixed getCustomPragmaVal to allow multiple fields in custom annotations (#10289)
Diffstat (limited to 'tests/pragmas')
-rw-r--r--tests/pragmas/tcustom_pragma.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim
index fefcc0b5f..e04d3de26 100644
--- a/tests/pragmas/tcustom_pragma.nim
+++ b/tests/pragmas/tcustom_pragma.nim
@@ -219,3 +219,12 @@ block:
   check(x)
   check(y)
   check(z)
+
+# pragma with multiple fields
+block:
+  template myAttr(first: string, second: int, third: float) {.pragma.}
+  let a {.myAttr("one", 2, 3.0).} = 0
+  let ps = a.getCustomPragmaVal(myAttr)
+  doAssert ps.first == ps[0] and ps.first == "one"
+  doAssert ps.second == ps[1] and ps.second == 2
+  doAssert ps.third == ps[2] and ps.third == 3.0