summaryrefslogtreecommitdiffhomepage
path: root/tests/custom
diff options
context:
space:
mode:
Diffstat (limited to 'tests/custom')
-rw-r--r--tests/custom/00_syntax/25_and_or_assignment30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/custom/00_syntax/25_and_or_assignment b/tests/custom/00_syntax/25_and_or_assignment
index 4dbc5f3..d6a9415 100644
--- a/tests/custom/00_syntax/25_and_or_assignment
+++ b/tests/custom/00_syntax/25_and_or_assignment
@@ -53,3 +53,33 @@ expression result if the lhs is falsy.
printf("%.J\n", [ x, y, z ]);
%}
-- End --
+
+
+3. Ensure that the assignment value expression is not evaluated if the
+assignment condition is false.
+
+-- Expect stdout --
+[
+ 0,
+ 0,
+ 0
+]
+-- End --
+
+-- Testcase --
+{%
+ a = 0;
+ b = 0;
+ c = 0;
+
+ x = false;
+ y = false;
+ z = true;
+
+ x ??= a++;
+ y &&= b++;
+ z ||= c++;
+
+ printf("%.J\n", [ a, b, c ]);
+%}
+-- End --