about summary refs log tree commit diff
path: root/z-yants-tests.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-08-28T13·33+0100
committerVincent Ambo <tazjin@google.com>2019-08-28T13·37+0100
commit34a591798179c87b84692712398359609a18c513 (patch)
treefcae33e95e9bd5ec95fb8b8fa23c29e9596bc165 /z-yants-tests.nix
parentcb45536124ce5cd1f34dc16bc853ecaaf8f08980 (diff)
test: Add test for pattern matching on sum types
Diffstat (limited to 'z-yants-tests.nix')
-rw-r--r--z-yants-tests.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/z-yants-tests.nix b/z-yants-tests.nix
index b97d058c0447..e1e521c5abf0 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");