Add tests for failed tuple bindings

This commit is contained in:
Mark Spanbroek 2023-02-13 12:16:50 +01:00
parent 935535a76e
commit 6382af43b3
2 changed files with 10 additions and 0 deletions

View File

@ -172,6 +172,11 @@ suite "optionals":
else:
fail()
if (a, b) =? none (string, int):
discard a
discard b
fail()
test "=? binds and unpacks tuples with named fields":
if (a, b) =? (some (desc: "test", id: 1)):
check a == "test"

View File

@ -172,6 +172,11 @@ suite "result":
else:
fail()
if (a, b) =? (string, int).failure(error):
discard a
discard b
fail()
test "=? binds and unpacks tuples with named fields":
if (a, b) =? (success (desc: "test", id: 1)):
check a == "test"