diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-23 23:51:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-23 23:51:49 +0800 |
commit | f40f5eb228aa576f2555b5aaa20f3a676aaad147 (patch) | |
tree | 6a6f176ee0afc1af3a0fc68d49087322a5e289a0 /test/compress/issue-1704.js | |
parent | 604caa09e7181791621db6c96b92cb8ecc7ace24 (diff) | |
download | tracifyjs-f40f5eb228aa576f2555b5aaa20f3a676aaad147.tar.gz tracifyjs-f40f5eb228aa576f2555b5aaa20f3a676aaad147.zip |
improve `mangle` (#2948)
Diffstat (limited to 'test/compress/issue-1704.js')
-rw-r--r-- | test/compress/issue-1704.js | 96 |
1 files changed, 94 insertions, 2 deletions
diff --git a/test/compress/issue-1704.js b/test/compress/issue-1704.js index 25e49522..043038e5 100644 --- a/test/compress/issue-1704.js +++ b/test/compress/issue-1704.js @@ -104,7 +104,7 @@ mangle_catch_toplevel: { } console.log(a); } - expect_exact: 'var o="FAIL";try{throw 1}catch(c){o="PASS"}console.log(o);' + expect_exact: 'var c="FAIL";try{throw 1}catch(o){c="PASS"}console.log(c);' expect_stdout: "PASS" } @@ -148,7 +148,7 @@ mangle_catch_var_toplevel: { } console.log(a); } - expect_exact: 'var o="FAIL";try{throw 1}catch(r){var o="PASS"}console.log(o);' + expect_exact: 'var r="FAIL";try{throw 1}catch(o){var r="PASS"}console.log(r);' expect_stdout: "PASS" } @@ -345,3 +345,95 @@ mangle_catch_redef_2_ie8_toplevel: { expect_exact: 'try{throw"FAIL1"}catch(o){var o="FAIL2"}console.log(o);' expect_stdout: "undefined" } + +mangle_catch_redef_3: { + mangle = { + ie8: false, + toplevel: false, + } + input: { + var o = "PASS"; + try { + throw 0; + } catch (o) { + (function() { + function f() { + o = "FAIL"; + } + f(), f(); + })(); + } + console.log(o); + } + expect_exact: 'var o="PASS";try{throw 0}catch(o){(function(){function c(){o="FAIL"}c(),c()})()}console.log(o);' + expect_stdout: "PASS" +} + +mangle_catch_redef_3_toplevel: { + mangle = { + ie8: false, + toplevel: true, + } + input: { + var o = "PASS"; + try { + throw 0; + } catch (o) { + (function() { + function f() { + o = "FAIL"; + } + f(), f(); + })(); + } + console.log(o); + } + expect_exact: 'var c="PASS";try{throw 0}catch(c){(function(){function o(){c="FAIL"}o(),o()})()}console.log(c);' + expect_stdout: "PASS" +} + +mangle_catch_redef_ie8_3: { + mangle = { + ie8: true, + toplevel: false, + } + input: { + var o = "PASS"; + try { + throw 0; + } catch (o) { + (function() { + function f() { + o = "FAIL"; + } + f(), f(); + })(); + } + console.log(o); + } + expect_exact: 'var o="PASS";try{throw 0}catch(o){(function(){function c(){o="FAIL"}c(),c()})()}console.log(o);' + expect_stdout: "PASS" +} + +mangle_catch_redef_3_ie8_toplevel: { + mangle = { + ie8: true, + toplevel: true, + } + input: { + var o = "PASS"; + try { + throw 0; + } catch (o) { + (function() { + function f() { + o = "FAIL"; + } + f(), f(); + })(); + } + console.log(o); + } + expect_exact: 'var c="PASS";try{throw 0}catch(c){(function(){function o(){c="FAIL"}o(),o()})()}console.log(c);' + expect_stdout: "PASS" +} |