aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/collapse_vars.js25
-rw-r--r--test/compress/const.js31
-rw-r--r--test/compress/let.js34
3 files changed, 90 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index dea01b60..edf4795a 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -8577,3 +8577,28 @@ issue_4242: {
}
expect_stdout: "undefined"
}
+
+issue_4248: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = 0;
+ try {
+ a = 1;
+ b[1];
+ } catch (e) {
+ console.log(a);
+ }
+ }
+ expect: {
+ var a = 0;
+ try {
+ a = 1;
+ b[1];
+ } catch (e) {
+ console.log(a);
+ }
+ }
+ expect_stdout: "1"
+}
diff --git a/test/compress/const.js b/test/compress/const.js
index 2f88975e..896e8c38 100644
--- a/test/compress/const.js
+++ b/test/compress/const.js
@@ -1104,3 +1104,34 @@ issue_4245: {
}
expect_stdout: true
}
+
+issue_4248: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = "FAIL";
+ try {
+ (function() {
+ a = "PASS";
+ b[a];
+ const b = 0;
+ })();
+ } catch (e) {
+ console.log(a);
+ }
+ }
+ expect: {
+ var a = "FAIL";
+ try {
+ (function() {
+ a = "PASS";
+ b[a];
+ const b = 0;
+ })();
+ } catch (e) {
+ console.log(a);
+ }
+ }
+ expect_stdout: "PASS"
+}
diff --git a/test/compress/let.js b/test/compress/let.js
index deb48120..9a6fc944 100644
--- a/test/compress/let.js
+++ b/test/compress/let.js
@@ -916,3 +916,37 @@ issue_4245: {
expect_stdout: ReferenceError("a is not defined")
node_version: ">=4"
}
+
+issue_4248: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = "FAIL";
+ try {
+ (function() {
+ "use strict";
+ a = "PASS";
+ b[a];
+ let b;
+ })();
+ } catch (e) {
+ console.log(a);
+ }
+ }
+ expect: {
+ var a = "FAIL";
+ try {
+ (function() {
+ "use strict";
+ a = "PASS";
+ b[a];
+ let b;
+ })();
+ } catch (e) {
+ console.log(a);
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}