diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-16 23:20:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 23:20:06 +0800 |
commit | 3563d8c09e36be8f8b9cb9500852778f8d191d5d (patch) | |
tree | 0dd9079d22c4a1f30ea90feefa7c66e9804a52cd /test/compress/issue-1588.js | |
parent | 5ae04b35452693e886a7f836e62e3290b08016a1 (diff) | |
download | tracifyjs-3563d8c09e36be8f8b9cb9500852778f8d191d5d.tar.gz tracifyjs-3563d8c09e36be8f8b9cb9500852778f8d191d5d.zip |
extend `test/run-tests.js` to optionally execute uglified output (#1604)
fixes #1588
Diffstat (limited to 'test/compress/issue-1588.js')
-rw-r--r-- | test/compress/issue-1588.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/compress/issue-1588.js b/test/compress/issue-1588.js new file mode 100644 index 00000000..ff25635c --- /dev/null +++ b/test/compress/issue-1588.js @@ -0,0 +1,87 @@ +screw_ie8: { + options = { + screw_ie8: true, + } + mangle = { + screw_ie8: true, + } + input: { + try { throw "foo"; } catch (x) { console.log(x); } + } + expect_exact: 'try{throw"foo"}catch(o){console.log(o)}' + expect_stdout: [ + "foo" + ] +} + +support_ie8: { + options = { + screw_ie8: false, + } + mangle = { + screw_ie8: false, + } + input: { + try { throw "foo"; } catch (x) { console.log(x); } + } + expect_exact: 'try{throw"foo"}catch(x){console.log(x)}' + expect_stdout: "foo" +} + +safe_undefined: { + options = { + conditionals: true, + if_return: true, + unsafe: false, + } + mangle = {} + input: { + var a, c; + console.log(function(undefined) { + return function() { + if (a) + return b; + if (c) + return d; + }; + }(1)()); + } + expect: { + var a, c; + console.log(function(n) { + return function() { + return a ? b : c ? d : void 0; + }; + }(1)()); + } + expect_stdout: true +} + +unsafe_undefined: { + options = { + conditionals: true, + if_return: true, + unsafe: true, + } + mangle = {} + input: { + var a, c; + console.log(function(undefined) { + return function() { + if (a) + return b; + if (c) + return d; + }; + }()()); + } + expect: { + var a, c; + console.log(function(n) { + return function() { + return a ? b : c ? d : n; + }; + }()()); + } + expect_stdout: true +} |