add test for short-circuit AND and OR assignment

closes #31
master
Andrew Kelley 2017-01-16 14:58:22 -05:00
parent c715309bc5
commit 98faf4f749
1 changed files with 14 additions and 0 deletions

View File

@ -30,3 +30,17 @@ fn boolCmp() {
fn testBoolCmp(a: bool, b: bool) -> bool { fn testBoolCmp(a: bool, b: bool) -> bool {
a == b a == b
} }
fn shortCircuitAndOr() {
@setFnTest(this);
var a = true;
a &&= false;
assert(!a);
a &&= true;
assert(!a);
a ||= false;
assert(!a);
a ||= true;
assert(a);
}