Skip to content

Commit 0313bce

Browse files
authored
test ? in ok (fixes #23) (#47)
1 parent 410afe8 commit 0313bce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_results.nim

+8
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,14 @@ block: # Result[T, void] aka `Opt`
592592
doAssert oOk.value() in oOk
593593
doAssert oOk.value() + 1 notin oOk
594594

595+
block: # Nested `?`
596+
proc inside: Opt[int] =
597+
ok(5)
598+
proc kput: Opt[int] =
599+
ok(? inside())
600+
601+
doAssert kput() == Opt.some(5)
602+
595603
block: # `cstring` dangling reference protection
596604
type CSRes = Result[void, cstring]
597605

0 commit comments

Comments
 (0)