aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/assignment.js36
-rw-r--r--test/compress/dead-code.js53
-rw-r--r--test/compress/drop-unused.js8
-rw-r--r--test/compress/sequences.js6
4 files changed, 63 insertions, 40 deletions
diff --git a/test/compress/assignment.js b/test/compress/assignment.js
index 191b892e..ece0185d 100644
--- a/test/compress/assignment.js
+++ b/test/compress/assignment.js
@@ -311,39 +311,3 @@ issue_3375: {
}
expect_stdout: "string"
}
-
-issue_3402: {
- options = {
- assignments: true,
- evaluate: true,
- functions: true,
- passes: 2,
- reduce_vars: true,
- side_effects: true,
- toplevel: true,
- typeofs: true,
- unused: true,
- }
- input: {
- var f = function f() {
- f = 42;
- console.log(typeof f);
- };
- "function" == typeof f && f();
- "function" == typeof f && f();
- console.log(typeof f);
- }
- expect: {
- function f() {
- console.log(typeof f);
- }
- f();
- f();
- console.log(typeof f);
- }
- expect_stdout: [
- "function",
- "function",
- "function",
- ]
-}
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js
index 5f1ca71c..190a3243 100644
--- a/test/compress/dead-code.js
+++ b/test/compress/dead-code.js
@@ -960,3 +960,56 @@ unsafe_string_replace: {
}
expect_stdout: "PASS"
}
+
+issue_3402: {
+ options = {
+ dead_code: true,
+ evaluate: true,
+ functions: true,
+ passes: 2,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ typeofs: true,
+ unused: true,
+ }
+ input: {
+ var f = function f() {
+ f = 42;
+ console.log(typeof f);
+ };
+ "function" == typeof f && f();
+ "function" == typeof f && f();
+ console.log(typeof f);
+ }
+ expect: {
+ function f() {
+ console.log(typeof f);
+ }
+ f();
+ f();
+ console.log(typeof f);
+ }
+ expect_stdout: [
+ "function",
+ "function",
+ "function",
+ ]
+}
+
+issue_3406: {
+ options = {
+ dead_code: true,
+ }
+ input: {
+ console.log(function f(a) {
+ return delete (f = a);
+ }());
+ }
+ expect: {
+ console.log(function f(a) {
+ return delete (0, a);
+ }());
+ }
+ expect_stdout: "true"
+}
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 0869749d..d7f3cf76 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -1005,7 +1005,7 @@ issue_1715_4: {
delete_assign_1: {
options = {
booleans: true,
- side_effects: true,
+ evaluate: true,
toplevel: true,
unused: true,
}
@@ -1024,7 +1024,7 @@ delete_assign_1: {
console.log((1 / 0, !0));
console.log((1 / 0, !0));
console.log((NaN, !0));
- console.log((0 / 0, !0));
+ console.log((NaN, !0));
}
expect_stdout: true
}
@@ -1032,8 +1032,8 @@ delete_assign_1: {
delete_assign_2: {
options = {
booleans: true,
+ evaluate: true,
keep_infinity: true,
- side_effects: true,
toplevel: true,
unused: true,
}
@@ -1052,7 +1052,7 @@ delete_assign_2: {
console.log((Infinity, !0));
console.log((1 / 0, !0));
console.log((NaN, !0));
- console.log((0 / 0, !0));
+ console.log((NaN, !0));
}
expect_stdout: true
}
diff --git a/test/compress/sequences.js b/test/compress/sequences.js
index 47dd4c4f..08a06790 100644
--- a/test/compress/sequences.js
+++ b/test/compress/sequences.js
@@ -490,6 +490,7 @@ issue_1758: {
delete_seq_1: {
options = {
booleans: true,
+ evaluate: true,
side_effects: true,
}
input: {
@@ -514,6 +515,7 @@ delete_seq_1: {
delete_seq_2: {
options = {
booleans: true,
+ evaluate: true,
side_effects: true,
}
input: {
@@ -538,6 +540,7 @@ delete_seq_2: {
delete_seq_3: {
options = {
booleans: true,
+ evaluate: true,
keep_infinity: true,
side_effects: true,
}
@@ -563,6 +566,7 @@ delete_seq_3: {
delete_seq_4: {
options = {
booleans: true,
+ evaluate: true,
sequences: true,
side_effects: true,
}
@@ -590,6 +594,7 @@ delete_seq_4: {
delete_seq_5: {
options = {
booleans: true,
+ evaluate: true,
keep_infinity: true,
sequences: true,
side_effects: true,
@@ -618,6 +623,7 @@ delete_seq_5: {
delete_seq_6: {
options = {
booleans: true,
+ evaluate: true,
side_effects: true,
}
input: {