diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 97 | ||||
-rw-r--r-- | test/compress/ie8.js | 160 | ||||
-rw-r--r-- | test/compress/reduce_vars.js | 8 | ||||
-rw-r--r-- | test/ufuzz.json | 1 |
4 files changed, 257 insertions, 9 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 15d8243c..31eb2383 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -5730,3 +5730,100 @@ issue_3096: { } expect_stdout: "ab" } + +issue_3215_1: { + options = { + collapse_vars: true, + evaluate: true, + ie8: false, + inline: true, + passes: 2, + side_effects: true, + unused: true, + } + input: { + console.log(function a() { + var a = 42; + return typeof a; + }()); + } + expect: { + console.log("number"); + } + expect_stdout: "number" +} + +issue_3215_2: { + options = { + collapse_vars: true, + evaluate: true, + ie8: true, + inline: true, + passes: 2, + side_effects: true, + unused: true, + } + input: { + console.log(function a() { + var a = 42; + return typeof a; + }()); + } + expect: { + console.log(function a() { + var a = 42; + return typeof a; + }()); + } + expect_stdout: "number" +} + +issue_3215_3: { + options = { + collapse_vars: true, + evaluate: true, + ie8: false, + inline: true, + passes: 2, + side_effects: true, + unused: true, + } + input: { + console.log(function() { + var a = 42; + (function a() {}); + return typeof a; + }()); + } + expect: { + console.log("number"); + } + expect_stdout: "number" +} + +issue_3215_4: { + options = { + collapse_vars: true, + evaluate: true, + ie8: true, + inline: true, + passes: 2, + side_effects: true, + unused: true, + } + input: { + console.log(function() { + var a = 42; + (function a() {}); + return typeof a; + }()); + } + expect: { + console.log(function() { + var a = 42; + (function a() {}); + return typeof a; + }()); + } + expect_stdout: "number" +} diff --git a/test/compress/ie8.js b/test/compress/ie8.js index 3fce9ef4..c5a20ed7 100644 --- a/test/compress/ie8.js +++ b/test/compress/ie8.js @@ -458,8 +458,8 @@ issue_2976_2: { } expect: { console.log(function f() { - var n; - return n === f ? "FAIL" : "PASS"; + var o; + return o === f ? "FAIL" : "PASS"; }()); } expect_stdout: "PASS" @@ -477,9 +477,9 @@ issue_2976_3: { }()); } expect: { - console.log(function o() { - var n; - return n === o ? "FAIL" : "PASS"; + console.log(function r() { + var o; + return o === r ? "FAIL" : "PASS"; }()); } expect_stdout: "PASS" @@ -678,6 +678,7 @@ issue_3206_1: { input: { console.log(function() { var foo = function bar() {}; + var baz = function moo() {}; return "function" == typeof bar; }()); } @@ -700,6 +701,7 @@ issue_3206_2: { input: { console.log(function() { var foo = function bar() {}; + var baz = function moo() {}; return "function" == typeof bar; }()); } @@ -711,3 +713,151 @@ issue_3206_2: { } expect_stdout: "false" } + +issue_3215_1: { + mangle = { + ie8: false, + } + input: { + console.log(function foo() { + var bar = function bar(name) { + return "PASS"; + }; + try { + "moo"; + } catch (e) { + bar = function bar(name) { + return "FAIL"; + }; + } + return bar; + }()()); + } + expect: { + console.log(function n() { + var o = function n(o) { + return "PASS"; + }; + try { + "moo"; + } catch (n) { + o = function n(o) { + return "FAIL"; + }; + } + return o; + }()()); + } + expect_stdout: "PASS" +} + +issue_3215_2: { + mangle = { + ie8: true, + } + input: { + console.log(function foo() { + var bar = function bar(name) { + return "PASS"; + }; + try { + "moo"; + } catch (e) { + bar = function bar(name) { + return "FAIL"; + }; + } + return bar; + }()()); + } + expect: { + console.log(function foo() { + var r = function r(o) { + return "PASS"; + }; + try { + "moo"; + } catch (o) { + r = function r(o) { + return "FAIL"; + }; + } + return r; + }()()); + } + expect_stdout: "PASS" +} + +issue_3215_3: { + mangle = { + ie8: false, + } + input: { + console.log(function foo() { + var bar = function bar(name) { + return "FAIL"; + }; + try { + moo; + } catch (e) { + bar = function bar(name) { + return "PASS"; + }; + } + return bar; + }()()); + } + expect: { + console.log(function n() { + var o = function n(o) { + return "FAIL"; + }; + try { + moo; + } catch (n) { + o = function n(o) { + return "PASS"; + }; + } + return o; + }()()); + } + expect_stdout: "PASS" +} + +issue_3215_4: { + mangle = { + ie8: true, + } + input: { + console.log(function foo() { + var bar = function bar(name) { + return "FAIL"; + }; + try { + moo; + } catch (e) { + bar = function bar(name) { + return "PASS"; + }; + } + return bar; + }()()); + } + expect: { + console.log(function foo() { + var r = function r(o) { + return "FAIL"; + }; + try { + moo; + } catch (o) { + r = function r(o) { + return "PASS"; + }; + } + return r; + }()()); + } + expect_stdout: "PASS" +} diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index c11d20c2..dad8ca3b 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -5231,11 +5231,11 @@ defun_catch_4: { try { throw 42; } catch (a) { - function a() {} console.log(a); } } - expect_stdout: true + expect_stdout: "42" + node_version: "<=4" } defun_catch_5: { @@ -5257,10 +5257,10 @@ defun_catch_5: { throw 42; } catch (a) { console.log(a); - function a() {} } } - expect_stdout: true + expect_stdout: "42" + node_version: "<=4" } defun_catch_6: { diff --git a/test/ufuzz.json b/test/ufuzz.json index ef4319b9..d20741a8 100644 --- a/test/ufuzz.json +++ b/test/ufuzz.json @@ -16,6 +16,7 @@ }, {}, { + "ie8": true, "toplevel": true }, { |