Skip to content

Commit

Permalink
a few more property tests
Browse files Browse the repository at this point in the history
  • Loading branch information
katsaii committed Aug 8, 2023
1 parent c01bcd8 commit ac947ca
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,25 @@ test_add(function () : Test("engine-properties-2") constructor {
assertEq(1, result.a);
assertEq(2, result.b);
assertEq(4, result.c);
});

test_add(function () : Test("engine-properties-get-set") constructor {
var engine = new CatspeakEnvironment();
var f = engine.compileGML(engine.parseString(@'
value = 0
let double = fun (x) {
if x == undefined { value } else { value = 2 * x }
}
:double = 8
let a = :double
:double += 6
let b = :double + :double
return [a, b]
'));
var result = f();
assertEq(2 * 8, result[0]);
assertEq(2 * (2 * 8 + 6) + 2 * (2 * 8 + 6), result[1]);
});

0 comments on commit ac947ca

Please sign in to comment.