about summary refs log tree commit diff stats
path: root/js/scripting-lang/tests/14_error_handling.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/tests/14_error_handling.txt')
-rw-r--r--js/scripting-lang/tests/14_error_handling.txt40
1 files changed, 20 insertions, 20 deletions
diff --git a/js/scripting-lang/tests/14_error_handling.txt b/js/scripting-lang/tests/14_error_handling.txt
index ce485f7..36fa9de 100644
--- a/js/scripting-lang/tests/14_error_handling.txt
+++ b/js/scripting-lang/tests/14_error_handling.txt
@@ -7,9 +7,9 @@ valid_test : 5 + 3;
 
 /* Test division by zero handling */
 /* This should be handled gracefully */
-safe_div : x y -> case y of
-    0 : "division by zero"
-    _ : x / y;
+safe_div : x y -> when y is
+    0 then "division by zero"
+    _ then x / y;
 
 div_result1 : safe_div 10 2;
 div_result2 : safe_div 10 0;
@@ -18,28 +18,28 @@ div_result2 : safe_div 10 0;
 ..assert div_result2 = "division by zero";
 
 /* Test edge cases with proper handling */
-edge_case1 : case 0 of
-    0 : "zero"
-    _ : "other";
+edge_case1 : when 0 is
+    0 then "zero"
+    _ then "other";
 
-edge_case2 : case "" of
-    "" : "empty string"
-    _ : "other";
+edge_case2 : when "" is
+    "" then "empty string"
+    _  then "other";
 
-edge_case3 : case false of
-    false : "false"
-    _ : "other";
+edge_case3 : when false is
+    false then "false"
+    _     then "other";
 
 ..assert edge_case1 = "zero";
 ..assert edge_case2 = "empty string";
 ..assert edge_case3 = "false";
 
 /* Test complex error scenarios */
-complex_error_handling : input -> case input of
-    input < 0 : "negative"
-    input = 0 : "zero"
-    input > 100 : "too large"
-    _ : "valid";
+complex_error_handling : input -> when input is
+    input < 0 then "negative"
+    input = 0 then "zero"
+    input > 100 then "too large"
+    _ then "valid";
 
 complex_result1 : complex_error_handling -5;
 complex_result2 : complex_error_handling 0;
@@ -52,9 +52,9 @@ complex_result4 : complex_error_handling 50;
 ..assert complex_result4 = "valid";
 
 /* Test safe arithmetic operations */
-safe_add : x y -> case y of
-    0 : x
-    _ : x + y;
+safe_add : x y -> when y is
+    0 then x
+    _ then x + y;
 
 safe_result1 : safe_add 5 3;
 safe_result2 : safe_add 5 0;