about summary refs log tree commit diff stats
path: root/js/scripting-lang/scratch_tests/test_embedded_functions_simple.txt
blob: 550402c21bdb94277d95365bd198c96655440a3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Simple test for embedded functions in tables */

// Test 1: Just arrow functions (should work)
calculator : {
    add: x y -> x + y,
    multiply: x y -> x * y
};

// Test 2: Mixed content
mixed : {
    name: "Calculator",
    add: x y -> x + y
};

// Output tests
..out "=== SIMPLE EMBEDDED FUNCTIONS TEST ===";

..out "Calculator add:";
result1 : calculator.add 5 3;
..out result1;

..out "Calculator multiply:";
result2 : calculator.multiply 4 7;
..out result2;

..out "Mixed table:";
..out mixed.name;
result3 : mixed.add 10 20;
..out result3;