Commit 98faf4f749

Andrew Kelley <superjoe30@gmail.com>
2017-01-16 20:58:22
add test for short-circuit AND and OR assignment
closes #31
1 parent c715309
Changed files (1)
test
cases
test/cases/bool.zig
@@ -30,3 +30,17 @@ fn boolCmp() {
 fn testBoolCmp(a: bool, b: bool) -> bool {
     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);
+}