Added to ternary expression tests

This commit is contained in:
2023-02-03 17:22:44 +00:00
parent 90f91a234a
commit 8cc33f5fbb

View File

@@ -4,7 +4,6 @@
assert false ? false : true, "Basic false ternary failed";
}
//test nesting
{
fn least(a, b, c) {
@@ -16,6 +15,23 @@
assert least(9, 7, 5) == 5, "Least 9, 7, 5 failed";
}
//test division prevention
{
var x = 0;
assert x ? 0 : 1 / x == 0, "Division by zero prevention failed";
}
//test ambiguous syntax
{
var a = 1;
var b = 2;
var c = 3;
var d = 4;
var e = 5;
assert a ? b ? c : d : e == 3, "Ambiguous syntax failed";
}
print "All good";