aboutsummaryrefslogtreecommitdiff
path: root/test/compress/evaluate.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r--test/compress/evaluate.js67
1 files changed, 64 insertions, 3 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 04b15a8c..8e030d22 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1,6 +1,7 @@
and: {
options = {
- evaluate: true
+ evaluate: true,
+ side_effects: true,
}
input: {
var a;
@@ -76,7 +77,8 @@ and: {
or: {
options = {
- evaluate: true
+ evaluate: true,
+ side_effects: true,
}
input: {
var a;
@@ -158,7 +160,8 @@ or: {
unary_prefix: {
options = {
- evaluate: true
+ evaluate: true,
+ side_effects: true,
}
input: {
a = !0 && b;
@@ -1245,3 +1248,61 @@ self_comparison_2: {
}
expect_stdout: "false false true true 'number'"
}
+
+issue_2535_1: {
+ options = {
+ booleans: true,
+ evaluate: true,
+ sequences: true,
+ side_effects: true,
+ }
+ input: {
+ if ((x() || true) || y()) z();
+ if ((x() || true) && y()) z();
+ if ((x() && true) || y()) z();
+ if ((x() && true) && y()) z();
+ if ((x() || false) || y()) z();
+ if ((x() || false) && y()) z();
+ if ((x() && false) || y()) z();
+ if ((x() && false) && y()) z();
+ }
+ expect: {
+ if (x(), 1) z();
+ if (x(), y()) z();
+ if (x() || y()) z();
+ if (x() && y()) z();
+ if (x() || y()) z();
+ if (x() && y()) z();
+ if (x(), y()) z();
+ if (x(), 0) z();
+ }
+}
+
+issue_2535_2: {
+ options = {
+ booleans: true,
+ evaluate: true,
+ sequences: true,
+ side_effects: true,
+ }
+ input: {
+ (x() || true) || y();
+ (x() || true) && y();
+ (x() && true) || y();
+ (x() && true) && y();
+ (x() || false) || y();
+ (x() || false) && y();
+ (x() && false) || y();
+ (x() && false) && y();
+ }
+ expect: {
+ x(),
+ x(), y(),
+ x() || y(),
+ x() && y(),
+ x() || y(),
+ x() && y(),
+ x(), y(),
+ x();
+ }
+}