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.js42
1 files changed, 41 insertions, 1 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 0547e6d9..9d35ffa3 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -745,7 +745,7 @@ in_boolean_context: {
!b("foo"),
!b([1, 2]),
!b(/foo/),
- ![1, foo()],
+ (foo(), !1),
(foo(), !1)
);
}
@@ -1566,3 +1566,43 @@ issue_2968: {
}
expect_stdout: "PASS"
}
+
+truthy_conditionals: {
+ options = {
+ conditionals: true,
+ evaluate: true,
+ }
+ input: {
+ if (a = {}) x();
+ (b = /foo/) && y();
+ (c = function() {}) || z();
+ }
+ expect: {
+ a = {}, x();
+ b = /foo/, y();
+ c = function() {};
+ }
+}
+
+truthy_loops: {
+ options = {
+ evaluate: true,
+ loops: true,
+ }
+ input: {
+ while ([]) x();
+ do {
+ y();
+ } while(a = {});
+ }
+ expect: {
+ for (;;) {
+ [];
+ x();
+ }
+ for (;;) {
+ y();
+ a = {};
+ }
+ }
+}