diff options
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_each_parsing.txt')
-rw-r--r-- | js/scripting-lang/scratch_tests/test_each_parsing.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_each_parsing.txt b/js/scripting-lang/scratch_tests/test_each_parsing.txt new file mode 100644 index 0000000..59ba27c --- /dev/null +++ b/js/scripting-lang/scratch_tests/test_each_parsing.txt @@ -0,0 +1,27 @@ +/* Test to understand each parsing behavior */ + +numbers : {1, 2, 3, 4, 5}; +add_ten : x -> x + 10; + +/* Test 1: each with single table - should work like map */ +result1 : each @add_ten numbers; +..out "Test 1 - each with single table:"; +..out result1; + +/* Test 2: each with table and scalar - should work */ +result2 : each @add numbers 10; +..out "Test 2 - each with table and scalar:"; +..out result2; + +/* Test 3: each with two tables - should work */ +table1 : {a: 1, b: 2, c: 3}; +table2 : {a: 10, b: 20, c: 30}; +result3 : each @add table1 table2; +..out "Test 3 - each with two tables:"; +..out result3; + +/* Test 4: each with partial application - should work */ +add_to_ten : each @add 10; +result4 : add_to_ten numbers; +..out "Test 4 - each with partial application:"; +..out result4; \ No newline at end of file |