From 6382af43b38759a81cbfab9a0161637fd7b78b99 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 13 Feb 2023 12:16:50 +0100 Subject: [PATCH] Add tests for failed tuple bindings --- testmodules/options/test.nim | 5 +++++ testmodules/result/test.nim | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/testmodules/options/test.nim b/testmodules/options/test.nim index c6fc8a0..e79140c 100644 --- a/testmodules/options/test.nim +++ b/testmodules/options/test.nim @@ -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" diff --git a/testmodules/result/test.nim b/testmodules/result/test.nim index 81880c1..66aa2d6 100644 --- a/testmodules/result/test.nim +++ b/testmodules/result/test.nim @@ -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"