Test binding of optional tuple, not just tuple

This commit is contained in:
Mark Spanbroek 2023-02-13 11:25:00 +01:00
parent 6ccb74419f
commit decda57024

View File

@ -198,20 +198,20 @@ suite "optionals":
fail() fail()
test "=? binds and unpacks tuples with _": test "=? binds and unpacks tuples with _":
if (_, b) =? ("test", 1): if (_, b) =? some ("test", 1):
check b == 1 check b == 1
else: else:
fail() fail()
test "=? binds and unpacks tuples with named fields": test "=? binds and unpacks tuples with named fields":
if (a, b) =? (desc: "test", id: 1): if (a, b) =? some (desc: "test", id: 1):
check a == "test" check a == "test"
check b == 1 check b == 1
else: else:
fail() fail()
test "=? binds variable to tuples with named fields": test "=? binds variable to tuples with named fields":
if t =? (desc: "test", id: 1): if t =? some (desc: "test", id: 1):
check t.desc == "test" check t.desc == "test"
check t.id == 1 check t.id == 1
else: else: