From 5a3007ea91a3ee57a4fc3e34c0edd59a90b525c3 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 27 Nov 2023 19:00:20 +0100 Subject: WIP on code generation for case expressions --- tests.snug | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests.snug') diff --git a/tests.snug b/tests.snug index 698e71f..bf87448 100644 --- a/tests.snug +++ b/tests.snug @@ -24,3 +24,9 @@ (test "function application (const)" : Int : (const 1 (const 2 3)) "1") (test "function application (tuple)" : Tuple Int Int : (tuple 10 20) "(10,20)") (test "function application (swapped_tuple)" : Tuple Int Int : (swapped_tuple 10 20) "(20,10)") + +(fun swap ((t : Tuple Int Int)) : Tuple Int Int : + case t ( + (Tuple x y -> Tuple y x))) + +(test "pattern matching (tuple)" : Tuple Int Int : (swap (Tuple 1 2)) "(2,1)") -- cgit v1.2.3