aboutsummaryrefslogtreecommitdiff
path: root/test/compress/ie8.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-06-22 19:41:55 +0800
committeralexlamsl <alexlamsl@gmail.com>2018-06-24 04:00:36 +0800
commitab36b9b10a3e9923d76fdfba4f86cca1c07437d7 (patch)
treef01a11eb7a9af629d3108678a43b8b289d4cd168 /test/compress/ie8.js
parent28330913d871dd4bdb4e59464c7230f9ae4174fa (diff)
downloadtracifyjs-ab36b9b10a3e9923d76fdfba4f86cca1c07437d7.tar.gz
tracifyjs-ab36b9b10a3e9923d76fdfba4f86cca1c07437d7.zip
fix corner case in `ie8` (#3198)
fixes #3197
Diffstat (limited to 'test/compress/ie8.js')
-rw-r--r--test/compress/ie8.js138
1 files changed, 133 insertions, 5 deletions
diff --git a/test/compress/ie8.js b/test/compress/ie8.js
index b21b8411..c3012bfa 100644
--- a/test/compress/ie8.js
+++ b/test/compress/ie8.js
@@ -420,8 +420,8 @@ issue_24_2: {
})();
}
expect: {
- (function(n) {
- console.log(typeof function o(){} === typeof n ? "FAIL" : "PASS");
+ (function(o) {
+ console.log(typeof function n(){} === typeof o ? "FAIL" : "PASS");
})();
}
expect_stdout: "PASS"
@@ -457,9 +457,29 @@ issue_2976_2: {
}());
}
expect: {
- console.log(function n() {
- var o;
- return o === n ? "FAIL" : "PASS";
+ console.log(function f() {
+ var n;
+ return n === f ? "FAIL" : "PASS";
+ }());
+ }
+ expect_stdout: "PASS"
+}
+
+issue_2976_3: {
+ mangle = {
+ ie8: true,
+ toplevel: true,
+ }
+ input: {
+ console.log(function f() {
+ var a;
+ return a === f ? "FAIL" : "PASS";
+ }());
+ }
+ expect: {
+ console.log(function o() {
+ var n;
+ return n === o ? "FAIL" : "PASS";
}());
}
expect_stdout: "PASS"
@@ -538,3 +558,111 @@ issue_3035_ie8: {
}
expect_stdout: "PASS"
}
+
+issue_3197_1: {
+ options = {
+ ie8: false,
+ inline: true,
+ reduce_vars: true,
+ side_effects: true,
+ unused: true,
+ }
+ mangle = {
+ ie8: false,
+ }
+ input: {
+ var window = {};
+ !function() {
+ function Foo() {
+ console.log(this instanceof Foo);
+ }
+ window.Foo = Foo;
+ }();
+ new window.Foo();
+ }
+ expect: {
+ var window = {};
+ window.Foo = function o() {
+ console.log(this instanceof o);
+ };
+ new window.Foo();
+ }
+ expect_stdout: "true"
+}
+
+issue_3197_1_ie8: {
+ options = {
+ ie8: true,
+ inline: true,
+ reduce_vars: true,
+ side_effects: true,
+ unused: true,
+ }
+ mangle = {
+ ie8: true,
+ }
+ input: {
+ var window = {};
+ !function() {
+ function Foo() {
+ console.log(this instanceof Foo);
+ }
+ window.Foo = Foo;
+ }();
+ new window.Foo();
+ }
+ expect: {
+ var window = {};
+ window.Foo = function Foo() {
+ console.log(this instanceof Foo);
+ };
+ new window.Foo();
+ }
+ expect_stdout: "true"
+}
+
+issue_3197_2: {
+ mangle = {
+ ie8: false,
+ }
+ input: {
+ (function(a) {
+ var f = function f() {
+ console.log(this instanceof f);
+ };
+ new f(a);
+ })();
+ }
+ expect: {
+ (function(n) {
+ var o = function n() {
+ console.log(this instanceof n);
+ };
+ new o(n);
+ })();
+ }
+ expect_stdout: "true"
+}
+
+issue_3197_2_ie8: {
+ mangle = {
+ ie8: true,
+ }
+ input: {
+ (function(a) {
+ var f = function f() {
+ console.log(this instanceof f);
+ };
+ new f(a);
+ })();
+ }
+ expect: {
+ (function(n) {
+ var o = function o() {
+ console.log(this instanceof o);
+ };
+ new o(n);
+ })();
+ }
+ expect_stdout: "true"
+}