diff options
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_control_only.txt')
-rw-r--r-- | js/scripting-lang/scratch_tests/test_control_only.txt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_control_only.txt b/js/scripting-lang/scratch_tests/test_control_only.txt new file mode 100644 index 0000000..5e4cc77 --- /dev/null +++ b/js/scripting-lang/scratch_tests/test_control_only.txt @@ -0,0 +1,25 @@ +/* Control tests that should work */ +test_simple : n -> + when n is + 0 then "zero" + 1 then "one" + _ then "other"; + +test_single_expr : n -> + when (n % 3) is + 0 then "divisible by 3" + _ then "not divisible by 3"; + +test_multi_simple : x y -> + when x y is + 0 0 then "both zero" + 0 _ then "x zero" + _ 0 then "y zero" + _ _ then "neither zero"; + +result1 : test_simple 5; +result2 : test_single_expr 15; +result3 : test_multi_simple 0 5; +..out result1; +..out result2; +..out result3; \ No newline at end of file |