From 34a591798179c87b84692712398359609a18c513 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 28 Aug 2019 14:33:41 +0100 Subject: [PATCH] test: Add test for pattern matching on sum types --- z-yants-tests.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/z-yants-tests.nix b/z-yants-tests.nix index b97d058c0..e1e521c5a 100644 --- a/z-yants-tests.nix +++ b/z-yants-tests.nix @@ -63,6 +63,11 @@ deepSeq rec { }; }; + testSumMatch = creature.match testSum { + human = v: "It's a human named ${v.name}"; + pet = v: throw "It's not supposed to be a pet!"; + }; + # Test curried function definitions func = defun [ string int string ] (name: age: "${name} is ${toString age} years old");