summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorjcosborn <jcosborn@users.noreply.github.com>2018-10-30 00:41:12 -0500
committerAndreas Rumpf <rumpf_a@web.de>2018-10-30 06:41:12 +0100
commit69c0a9c6fb688d382d83c165860006977dd6bf04 (patch)
tree2b24bd098fa8df10fea6912b09c952ad455393b1 /tests
parente377c55c10d4faea8f8d1ccd8b826bfeb7fe46db (diff)
downloadNim-69c0a9c6fb688d382d83c165860006977dd6bf04.tar.gz
getTypeImpl now returns pragmas for object types (#9538)
Diffstat (limited to 'tests')
-rw-r--r--tests/macros/tgettypeinst.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/macros/tgettypeinst.nim b/tests/macros/tgettypeinst.nim
index 2f1abe193..6a99dc8b7 100644
--- a/tests/macros/tgettypeinst.nim
+++ b/tests/macros/tgettypeinst.nim
@@ -183,3 +183,21 @@ test(Vec4[float32]):
 # bug #4862
 static:
   discard typedesc[(int, int)].getTypeImpl
+
+# custom pragmas
+template myAttr() {.pragma.}
+template myAttr2() {.pragma.}
+template myAttr3() {.pragma.}
+template serializationKey(key: string) {.pragma.}
+
+type
+  MyObj = object {.packed,myAttr,serializationKey: "one".}
+    myField {.myAttr2,serializationKey: "two".}: int
+    myField2 {.myAttr3,serializationKey: "three".}: float
+
+# field pragmas not currently supported
+test(MyObj):
+  type
+    _ = object {.packed,myAttr,serializationKey: "one".}
+      myField: int
+      myField2: float