aboutsummaryrefslogtreecommitdiff
path: root/test/compress/ie8.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-15 07:27:02 +0800
committerGitHub <noreply@github.com>2019-10-15 07:27:02 +0800
commitd3d1d11926de43fc1ec74ae3a4d24a884d80d91f (patch)
tree6db0bdae1d0b3805a75d7f69533e5f3ca29fe8c8 /test/compress/ie8.js
parent736019b767548268044e665bd6cde4b5e34c0bd3 (diff)
downloadtracifyjs-d3d1d11926de43fc1ec74ae3a4d24a884d80d91f.tar.gz
tracifyjs-d3d1d11926de43fc1ec74ae3a4d24a884d80d91f.zip
fix corner case in `ie8` & `rename` (#3474)
fixes #3473
Diffstat (limited to 'test/compress/ie8.js')
-rw-r--r--test/compress/ie8.js108
1 files changed, 108 insertions, 0 deletions
diff --git a/test/compress/ie8.js b/test/compress/ie8.js
index 94b83de6..9fc2becd 100644
--- a/test/compress/ie8.js
+++ b/test/compress/ie8.js
@@ -1081,3 +1081,111 @@ issue_3471_ie8: {
}
expect_stdout: true
}
+
+issue_3473: {
+ rename = true
+ mangle = {
+ ie8: false,
+ toplevel: false,
+ }
+ input: {
+ var d = 42, a = 100, b = 10, c = 0;
+ (function b() {
+ try {
+ c++;
+ } catch (b) {}
+ })();
+ console.log(a, b, c);
+ }
+ expect: {
+ var d = 42, a = 100, b = 10, c = 0;
+ (function a() {
+ try {
+ c++;
+ } catch (a) {}
+ })();
+ console.log(a, b, c);
+ }
+ expect_stdout: "100 10 1"
+}
+
+issue_3473_ie8: {
+ rename = true
+ mangle = {
+ ie8: true,
+ toplevel: false,
+ }
+ input: {
+ var d = 42, a = 100, b = 10, c = 0;
+ (function b() {
+ try {
+ c++;
+ } catch (b) {}
+ })();
+ console.log(a, b, c);
+ }
+ expect: {
+ var d = 42, a = 100, b = 10, c = 0;
+ (function b() {
+ try {
+ c++;
+ } catch (b) {}
+ })();
+ console.log(a, b, c);
+ }
+ expect_stdout: "100 10 1"
+}
+
+issue_3473_toplevel: {
+ rename = true
+ mangle = {
+ ie8: false,
+ toplevel: true,
+ }
+ input: {
+ var d = 42, a = 100, b = 10, c = 0;
+ (function b() {
+ try {
+ c++;
+ } catch (b) {}
+ })();
+ console.log(a, b, c);
+ }
+ expect: {
+ var c = 42, o = 100, n = 10, t = 0;
+ (function c() {
+ try {
+ t++;
+ } catch (c) {}
+ })();
+ console.log(o, n, t);
+ }
+ expect_stdout: "100 10 1"
+}
+
+issue_3473_ie8_toplevel: {
+ rename = true
+ mangle = {
+ ie8: true,
+ toplevel: true,
+ }
+ input: {
+ var d = 42, a = 100, b = 10, c = 0;
+ (function b() {
+ try {
+ c++;
+ } catch (b) {}
+ })();
+ console.log(a, b, c);
+ }
+ expect: {
+ var c = 42, o = 100, n = 10, t = 0;
+ (function n() {
+ try {
+ t++;
+ } catch (n) {}
+ })();
+ console.log(o, n, t);
+ }
+ expect_stdout: "100 10 1"
+}