diff options
Diffstat (limited to 'tests/objects/tobject_default_value.nim')
-rw-r--r-- | tests/objects/tobject_default_value.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/objects/tobject_default_value.nim b/tests/objects/tobject_default_value.nim index 150fb0876..59af943e0 100644 --- a/tests/objects/tobject_default_value.nim +++ b/tests/objects/tobject_default_value.nim @@ -559,6 +559,38 @@ template main {.dirty.} = let x = default(Default) doAssert x.data is DjangoDateTime + block: + type + Result2 = object + case o: bool + of false: + e: float + of true: + v {.requiresInit.} : int = 1 + + proc startSessionSync(): Result2 = + return Result2(o: true) + + proc mainSync = + let ff = startSessionSync() + doAssert ff.v == 1 + + mainSync() + + block: + type + Result2 = object + v {.requiresInit.} : int = 1 + + proc startSessionSync(): Result2 = + return Result2() + + proc mainSync = + let ff = startSessionSync() + doAssert ff.v == 1 + + mainSync() + static: main() main() |