mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Short circuits are now functioning correctly, resolved #73
This commit is contained in:
14
test/scripts/short-circuit.toy
Normal file
14
test/scripts/short-circuit.toy
Normal file
@@ -0,0 +1,14 @@
|
||||
//These operators should short-circuit
|
||||
assert true && false == false, "true && false == false failed";
|
||||
assert false && true == false, "false && true == false failed";
|
||||
|
||||
assert true || false == true, "true || false == true failed";
|
||||
assert false || true == true, "false || true == true failed";
|
||||
|
||||
|
||||
//make sure the right value is being returned when chained
|
||||
assert "a" && "b" && "c" == "c", "chained && failed";
|
||||
assert "a" || "b" || "c" == "a", "chained || failed";
|
||||
|
||||
|
||||
print "All good";
|
||||
@@ -138,6 +138,7 @@ int main() {
|
||||
"panic-within-functions.toy",
|
||||
"polyfill-insert.toy",
|
||||
"polyfill-remove.toy",
|
||||
"short-circuit.toy",
|
||||
"short-circuiting-support.toy",
|
||||
"ternary-expressions.toy",
|
||||
"trailing-comma-bugfix.toy",
|
||||
|
||||
Reference in New Issue
Block a user