Files
Toy/scripts/test/dot-chaining.toy
2022-10-16 10:35:44 +01:00

31 lines
406 B
Plaintext

//test function chaining with the dot operator
fn _identity(self) {
return self;
}
fn _check(self) {
assert self == 42, "dot chaining failed";
return self;
}
var val = 42;
val
.identity()
.check()
.identity()
.check()
;
//test the value is actually altered
fn _increment(self) {
return self + 1;
}
assert 3.increment().increment() == 5, "dot chaining increment failed";
print "All good";