about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests/integration_02_pattern_matching.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/tests/integration_02_pattern_matching.txt')
-rw-r--r--js/scripting-lang/tests/integration_02_pattern_matching.txt42
1 files changed, 21 insertions, 21 deletions
diff --git a/js/scripting-lang/tests/integration_02_pattern_matching.txt b/js/scripting-lang/tests/integration_02_pattern_matching.txt
index f0b969a..a67bf59 100644
--- a/js/scripting-lang/tests/integration_02_pattern_matching.txt
+++ b/js/scripting-lang/tests/integration_02_pattern_matching.txt
@@ -5,21 +5,21 @@
 
 /* Recursive factorial with case expressions */
 factorial : n -> 
-  case n of
-    0 : 1
-    _ : n * (factorial (n - 1));
+  when n is
+    0 then 1
+    _ then n * (factorial (n - 1));
 
 /* Pattern matching with multiple parameters */
 classify : x y -> 
-  case x y of
-    0 0 : "both zero"
-    0 _ : "x is zero"
-    _ 0 : "y is zero"
-    _ _ : case x of
-            0 : "x is zero (nested)"
-            _ : case y of
-                  0 : "y is zero (nested)"
-                  _ : "neither zero";
+  when x y is
+    0 0 then "both zero"
+    0 _ then "x is zero"
+    _ 0 then "y is zero"
+    _ _ then when x is
+            0 then "x is zero (nested)"
+            _ then when y is
+                  0 then "y is zero (nested)"
+                  _ then "neither zero";
 
 /* Test factorial */
 fact5 : factorial 5;
@@ -41,15 +41,15 @@ test4 : classify 5 5;
 
 /* Complex nested case expressions */
 analyze : x y z -> 
-  case x y z of
-    0 0 0 : "all zero"
-    0 0 _ : "x and y zero"
-    0 _ 0 : "x and z zero"
-    _ 0 0 : "y and z zero"
-    0 _ _ : "only x zero"
-    _ 0 _ : "only y zero"
-    _ _ 0 : "only z zero"
-    _ _ _ : "none zero";
+  when x y z is
+    0 0 0 then "all zero"
+    0 0 _ then "x and y zero"
+    0 _ 0 then "x and z zero"
+    _ 0 0 then "y and z zero"
+    0 _ _ then "only x zero"
+    _ 0 _ then "only y zero"
+    _ _ 0 then "only z zero"
+    _ _ _ then "none zero";
 
 result1 : analyze 0 0 0;
 result2 : analyze 0 1 1;