aboutsummaryrefslogtreecommitdiff
path: root/test/compress/issue-1588.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-16 23:20:06 +0800
committerGitHub <noreply@github.com>2017-03-16 23:20:06 +0800
commit3563d8c09e36be8f8b9cb9500852778f8d191d5d (patch)
tree0dd9079d22c4a1f30ea90feefa7c66e9804a52cd /test/compress/issue-1588.js
parent5ae04b35452693e886a7f836e62e3290b08016a1 (diff)
downloadtracifyjs-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.js87
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
+}