commit 98faf4f74984db615ba62de285308dfc5092ec7c (tree) parent c715309bc5de874d3d418c80095d50f7efc17001 Author: Andrew Kelley <superjoe30@gmail.com> Date: Mon, 16 Jan 2017 14:58:22 -0500 add test for short-circuit AND and OR assignment closes #31 Diffstat:
| M | test/cases/bool.zig | | | 14 | ++++++++++++++ |
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/test/cases/bool.zig b/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); +}