diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-11-22 17:38:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 17:38:52 +0100 |
commit | 8faa3059951a38bc9e6065470892d01a92fa785b (patch) | |
tree | 39537641aa77efc0202d60fd270a592d4b660070 /tests | |
parent | 5fd5e8c3d785da27b90320f6ac93853ecf87eeae (diff) | |
parent | fdc9b6a3841d7346dab6f4aeea06322be0d3ee95 (diff) |
Merge pull request #123 from jow-/fix-logical-assignment-operators
compiler: fix `??=`, `||=` and `&&=` logical assignment sementics
Diffstat (limited to 'tests')
-rw-r--r-- | tests/custom/00_syntax/25_and_or_assignment | 30 |
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 -- |