aboutsummaryrefslogtreecommitdiff
path: root/tests.snug
diff options
context:
space:
mode:
authorCamil Staps2023-11-27 19:00:20 +0100
committerCamil Staps2023-11-27 19:00:20 +0100
commit5a3007ea91a3ee57a4fc3e34c0edd59a90b525c3 (patch)
tree3addc1233eb1e80657fa36b6599e3ebe3d097d88 /tests.snug
parentUpdate to base 2.0 (diff)
WIP on code generation for case expressions
Diffstat (limited to 'tests.snug')
-rw-r--r--tests.snug6
1 files changed, 6 insertions, 0 deletions
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)")