summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorRSDuck <RSDuck@users.noreply.github.com>2018-04-19 11:07:45 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-04-19 11:07:45 +0200
commit34029263725ef931863ea73966dc08588758dada (patch)
tree90ad5bd8291401c69d7a5baa6af213d5a1dd5415 /tests
parent0dc4d6dcc28a6e35f36caaa5bcc801b4acac61b4 (diff)
downloadNim-34029263725ef931863ea73966dc08588758dada.tar.gz
hasCustomPragma/getCustomPragmaVal: small fix (#7650)
* fix hasCustomPragma/getCustomPragmaVal for types without pragma

* fix pragma on pointer test

* removed trailing spaces
Diffstat (limited to 'tests')
-rw-r--r--tests/pragmas/tcustom_pragma.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim
index 28a8713ce..33a4a7e65 100644
--- a/tests/pragmas/tcustom_pragma.nim
+++ b/tests/pragmas/tcustom_pragma.nim
@@ -51,6 +51,9 @@ block: # A bit more advanced case
 
   static: assert(hasCustomPragma(myproc, alternativeKey))
 
+  const hasFieldCustomPragma = s.field.hasCustomPragma(defaultValue)
+  static: assert(hasFieldCustomPragma == false)
+
   # pragma on an object
   static:
     assert Subfield.hasCustomPragma(defaultValue)
@@ -71,6 +74,8 @@ block: # ref types
     MyFile {.defaultValue: "closed".} = ref object
       path {.defaultValue: "invalid".}: string
 
+    TypeWithoutPragma = object
+
   var s = NodeRef()
 
   const
@@ -91,7 +96,7 @@ block: # ref types
 
   var ptrS = NodePtr(nil)
   const
-    ptrRightSerKey = getCustomPragmaVal(s.right, serializationKey)
+    ptrRightSerKey = getCustomPragmaVal(ptrS.right, serializationKey)
   static:
     assert ptrRightSerKey == "r"
 
@@ -103,6 +108,9 @@ block: # ref types
     assert fileDefVal == "closed"
     assert filePathDefVal == "invalid"
 
+  static:
+    assert TypeWithoutPragma.hasCustomPragma(defaultValue) == false
+
 block:
   type
     VariantKind = enum