diff options
Diffstat (limited to 'tests/pragmas/tcustom_pragma.nim')
-rw-r--r-- | tests/pragmas/tcustom_pragma.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim index a2380522f..415ae6a32 100644 --- a/tests/pragmas/tcustom_pragma.nim +++ b/tests/pragmas/tcustom_pragma.nim @@ -31,6 +31,11 @@ block: # A bit more advanced case d {.alternativeKey("df", 5).}: float e {.alternativeKey(V = 5).}: seq[bool] + + proc myproc(x: int, s: string) {.alternativeKey(V = 5), serializationKey"myprocSS".} = + echo x, s + + var s: MySerializable const aDefVal = s.a.getCustomPragmaVal(defaultValue) @@ -41,3 +46,8 @@ block: # A bit more advanced case const cSerKey = getCustomPragmaVal(s.field.c, serializationKey) static: assert(cSerKey == "cc") + + const procSerKey = getCustomPragmaVal(myproc, serializationKey) + static: assert(procSerKey == "myprocSS") + + static: assert(hasCustomPragma(myproc, alternativeKey)) |