aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-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
+}