diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/arguments.js | 30 | ||||
-rw-r--r-- | test/compress/arrows.js | 4 | ||||
-rw-r--r-- | test/compress/async.js | 2 | ||||
-rw-r--r-- | test/compress/default-values.js | 2 | ||||
-rw-r--r-- | test/compress/destructured.js | 16 | ||||
-rw-r--r-- | test/compress/drop-unused.js | 66 | ||||
-rw-r--r-- | test/compress/functions.js | 12 | ||||
-rw-r--r-- | test/compress/issue-976.js | 93 | ||||
-rw-r--r-- | test/compress/join_vars.js | 2 | ||||
-rw-r--r-- | test/compress/keep_fargs.js | 131 | ||||
-rw-r--r-- | test/compress/loops.js | 4 | ||||
-rw-r--r-- | test/compress/merge_vars.js | 2 | ||||
-rw-r--r-- | test/compress/pure_funcs.js | 8 | ||||
-rw-r--r-- | test/compress/reduce_vars.js | 6 | ||||
-rw-r--r-- | test/compress/side_effects.js | 2 | ||||
-rw-r--r-- | test/compress/spread.js | 2 | ||||
-rw-r--r-- | test/input/reduce/diff_error.js | 10 | ||||
-rw-r--r-- | test/input/reduce/diff_error.reduced.js | 17 | ||||
-rw-r--r-- | test/input/reduce/setter.js | 13 | ||||
-rw-r--r-- | test/input/reduce/setter.reduced.js | 20 | ||||
-rw-r--r-- | test/mocha/reduce.js | 22 | ||||
-rw-r--r-- | test/ufuzz/options.json | 1 |
22 files changed, 211 insertions, 254 deletions
diff --git a/test/compress/arguments.js b/test/compress/arguments.js index ddf5695b..3ca244af 100644 --- a/test/compress/arguments.js +++ b/test/compress/arguments.js @@ -78,7 +78,7 @@ replace_index_strict: { ] } -replace_index_keep_fargs: { +replace_index_drop_fargs_1: { options = { arguments: true, evaluate: true, @@ -128,7 +128,7 @@ replace_index_keep_fargs: { ] } -replace_index_keep_fargs_strict: { +replace_index_drop_fargs_2: { options = { arguments: true, evaluate: true, @@ -412,7 +412,7 @@ issue_3273_global_strict_reduce_vars: { ] } -issue_3273_keep_fargs_false: { +issue_3273_drop_fargs_1: { options = { arguments: true, keep_fargs: false, @@ -435,10 +435,10 @@ issue_3273_keep_fargs_false: { expect_stdout: "1" } -issue_3273_keep_fargs_strict: { +issue_3273_drop_fargs_2: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, } input: { @@ -633,7 +633,7 @@ issue_3282_2_passes: { issue_3420_1: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { console.log(function() { @@ -655,7 +655,7 @@ issue_3420_1: { issue_3420_2: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { var foo = function() { @@ -675,7 +675,7 @@ issue_3420_2: { issue_3420_3: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { "use strict"; @@ -697,7 +697,7 @@ issue_3420_3: { issue_3420_4: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { !function() { @@ -722,7 +722,7 @@ issue_3420_4: { issue_3420_5: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { "use strict"; @@ -749,7 +749,7 @@ issue_3420_5: { issue_3420_6: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { console.log(function() { @@ -767,7 +767,7 @@ issue_3420_6: { issue_3420_7: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { "use strict"; @@ -811,7 +811,7 @@ issue_4200: { issue_4291_1: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { console.log(function() { @@ -831,7 +831,7 @@ issue_4291_1: { issue_4291_2: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { var a = function() { @@ -855,7 +855,7 @@ issue_4291_2: { issue_4397: { options = { arguments: true, - keep_fargs: "strict", + keep_fargs: false, } input: { console.log(typeof function() { diff --git a/test/compress/arrows.js b/test/compress/arrows.js index 7245c134..cc5aec5f 100644 --- a/test/compress/arrows.js +++ b/test/compress/arrows.js @@ -419,7 +419,7 @@ collapse_value: { options = { arrows: true, collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -437,7 +437,7 @@ collapse_value: { reduce_iife_1: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } diff --git a/test/compress/async.js b/test/compress/async.js index ffd941c8..bf4d55c8 100644 --- a/test/compress/async.js +++ b/test/compress/async.js @@ -353,7 +353,7 @@ property_access_expression: { reduce_iife_1: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } diff --git a/test/compress/default-values.js b/test/compress/default-values.js index ffc351c8..2e046444 100644 --- a/test/compress/default-values.js +++ b/test/compress/default-values.js @@ -481,7 +481,7 @@ retain_fargs: { drop_fargs: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { diff --git a/test/compress/destructured.js b/test/compress/destructured.js index 66aebc1c..5594658d 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -40,7 +40,7 @@ redefine_arguments_2: { redefine_arguments_3: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -259,7 +259,7 @@ funarg_side_effects_3: { funarg_unused_1: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -318,7 +318,7 @@ funarg_unused_3: { funarg_unused_4: { options = { - keep_fargs: "strict", + keep_fargs: false, pure_getters: "strict", unused: true, } @@ -384,7 +384,7 @@ funarg_unused_6_inline: { funarg_unused_6_keep_fargs: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -426,7 +426,7 @@ funarg_collapse_vars_1: { funarg_collapse_vars_2: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -505,7 +505,7 @@ funarg_reduce_vars_1: { funarg_reduce_vars_2: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, pure_getters: "strict", reduce_vars: true, unsafe: true, @@ -1123,7 +1123,7 @@ join_vars: { keep_fargs: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -1776,7 +1776,7 @@ issue_4319: { issue_4321: { options = { inline: true, - keep_fargs: "strict", + keep_fargs: false, } input: { try { diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index d048707a..3feb0183 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -4,15 +4,16 @@ unused_funarg_1: { unused: true, } input: { - function f(a, b, c, d, e) { + console.log(function f(a, b, c, d, e) { return a + b; - } + }(14, 28)); } expect: { - function f(a, b) { + console.log(function(a, b) { return a + b; - } + }(14, 28)); } + expect_stdout: "42" } unused_funarg_2: { @@ -21,15 +22,16 @@ unused_funarg_2: { unused: true, } input: { - function f(a, b, c, d, e) { + console.log(function f(a, b, c, d, e) { return a + c; - } + }(14, 21, 28)); } expect: { - function f(a, b, c) { + console.log(function(a, c) { return a + c; - } + }(14, 28)); } + expect_stdout: "42" } unused_nested_function: { @@ -357,37 +359,6 @@ drop_toplevel_vars: { } } -drop_toplevel_vars_fargs: { - options = { - keep_fargs: false, - toplevel: "vars", - unused: true, - } - input: { - var a, b = 1, c = g; - function f(d) { - return function() { - c = 2; - }; - } - a = 2; - function g() {} - function h() {} - console.log(b = 3); - } - expect: { - function f() { - return function() { - 2; - }; - } - 2; - function g() {} - function h() {} - console.log(3); - } -} - drop_toplevel_all: { options = { toplevel: true, @@ -625,13 +596,14 @@ drop_fargs: { unused: true, } input: { - function f(a) { + console.log(function f(a) { var b = a; - } + }()); } expect: { - function f() {} + console.log(function() {}()); } + expect_stdout: "undefined" } drop_fnames: { @@ -2027,7 +1999,7 @@ issue_3192_1: { issue_3192_2: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -2435,7 +2407,7 @@ issue_3673: { issue_3746: { options = { - keep_fargs: "strict", + keep_fargs: false, side_effects: true, unused: true, } @@ -2713,7 +2685,7 @@ issue_3956: { issue_3962_1: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, toplevel: true, unused: true, @@ -2745,7 +2717,7 @@ issue_3962_1: { issue_3962_2: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, side_effects: true, toplevel: true, @@ -2948,7 +2920,7 @@ issue_4133: { issue_4144: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } diff --git a/test/compress/functions.js b/test/compress/functions.js index 1e7d3e2f..837d0a04 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -229,7 +229,7 @@ issue_203: { } expect: { var m = {}; - var fn = Function("n,o", "o.exports=42"); + var fn = Function("n,o,t", "o.exports=42"); fn(null, m, m.exports); console.log(m.exports); } @@ -4230,7 +4230,7 @@ substitute: { substitute_add_farg: { options = { inline: true, - keep_fargs: "strict", + keep_fargs: false, } input: { function f(g) { @@ -4411,7 +4411,9 @@ substitute_drop_farg: { return f; }, function() { - return f; + return function(d, e) { + return f(d, e); + }; }, ].forEach(function(g) { console.log(g()(o), g().call(o, o)); @@ -4594,7 +4596,7 @@ substitute_use_strict: { issue_3833: { options = { inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, toplevel: true, unused: true, @@ -4751,7 +4753,7 @@ issue_4006: { dead_code: true, evaluate: true, inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, sequences: true, side_effects: true, diff --git a/test/compress/issue-976.js b/test/compress/issue-976.js index edee2595..43533501 100644 --- a/test/compress/issue-976.js +++ b/test/compress/issue-976.js @@ -63,42 +63,81 @@ eval_unused: { unused: true, } input: { - function f1(a, eval, c, d, e) { - return a('c') + eval; - } - function f2(a, b, c, d, e) { - return a + eval('c'); - } - function f3(a, eval, c, d, e) { - return a + eval('c'); + function o(k) { + return { c: 14 }[k]; } + console.log(function f1(a, eval, c, d, e) { + return a("c") + eval; + }(o, 28, true)); + console.log(function f2(a, b, c, d, e) { + return a + eval("c"); + }(14, true, 28)); + console.log(function f3(a, eval, c, d, e) { + return a + eval("c"); + }(28, o, true)); } expect: { - function f1(a, eval) { - return a('c') + eval; - } - function f2(a, b, c, d, e) { - return a + eval('c'); - } - function f3(a, eval, c, d, e) { - return a + eval('c'); + function o(k) { + return { c: 14 }[k]; } + console.log(function(a, eval) { + return a("c") + eval; + }(o, 28)); + console.log(function f2(a, b, c, d, e) { + return a + eval("c"); + }(14, true, 28)); + console.log(function f3(a, eval, c, d, e) { + return a + eval("c"); + }(28, o, true)); } + expect_stdout: [ + "42", + "42", + "42", + ] } eval_mangle: { - mangle = { - }; + mangle = {} + beautify = { + beautify: true, + } input: { - function f1(a, eval, c, d, e) { - return a('c') + eval; - } - function f2(a, b, c, d, e) { - return a + eval('c'); - } - function f3(a, eval, c, d, e) { - return a + eval('c'); + function o(k) { + return { cc: 14 }[k + "c"]; } + console.log(function f1(a, eval, c, d, e) { + return a("c") + eval; + }(o, 28, true)); + console.log(function f2(a, b, c, d, e) { + return a + eval("c"); + }(14, true, 28)); + console.log(function f3(a, eval, c, d, e) { + return a + eval("c"); + }(28, o, true)); } - expect_exact: 'function f1(n,c,e,a,f){return n("c")+c}function f2(a,b,c,d,e){return a+eval("c")}function f3(a,eval,c,d,e){return a+eval("c")}' + expect_exact: [ + "function o(o) {", + " return {", + " cc: 14", + ' }[o + "c"];', + "}", + "", + "console.log(function o(c, e, n, r, t) {", + ' return c("c") + e;', + "}(o, 28, true));", + "", + "console.log(function f2(a, b, c, d, e) {", + ' return a + eval("c");', + "}(14, true, 28));", + "", + "console.log(function f3(a, eval, c, d, e) {", + ' return a + eval("c");', + "}(28, o, true));", + ] + expect_stdout: [ + "42", + "42", + "42", + ] } diff --git a/test/compress/join_vars.js b/test/compress/join_vars.js index c2c8e1e4..aec6a917 100644 --- a/test/compress/join_vars.js +++ b/test/compress/join_vars.js @@ -790,7 +790,7 @@ issue_3795: { dead_code: true, evaluate: true, join_vars: true, - keep_fargs: "strict", + keep_fargs: false, loops: true, passes: 2, reduce_vars: true, diff --git a/test/compress/keep_fargs.js b/test/compress/keep_fargs.js index 8d6c5c99..049684a7 100644 --- a/test/compress/keep_fargs.js +++ b/test/compress/keep_fargs.js @@ -19,43 +19,6 @@ keep_fargs_false: { console.log(h(), i().length, j.length); } expect: { - console.log(function f() { - return f.length; - }(), function g() { - return g; - }().length); - function h() { - return h.length; - } - function i() { - return i; - } - function j() {} - console.log(h(), i().length, j.length); - } -} - -keep_fargs_strict: { - options = { - keep_fargs: "strict", - unused: true, - } - input: { - console.log(function f(a) { - return f.length; - }(), function g(b) { - return g; - }().length); - function h(c) { - return h.length; - } - function i(d) { - return i; - } - function j(e) {} - console.log(h(), i().length, j.length); - } - expect: { console.log(function f(a) { return f.length; }(), function g(b) { @@ -121,7 +84,7 @@ replace_index: { options = { arguments: true, evaluate: true, - keep_fargs: "strict", + keep_fargs: false, properties: true, } input: { @@ -171,7 +134,7 @@ replace_index_strict: { options = { arguments: true, evaluate: true, - keep_fargs: "strict", + keep_fargs: false, properties: true, reduce_vars: true, } @@ -202,7 +165,7 @@ replace_index_strict: { issue_1858: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, pure_getters: true, unused: true, } @@ -224,7 +187,7 @@ issue_1858: { issue_2187_2: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -245,7 +208,7 @@ issue_2187_2: { issue_2203_2: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -280,7 +243,7 @@ issue_2203_2: { issue_2298: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_funcs: true, reduce_vars: true, @@ -323,7 +286,7 @@ issue_2298: { issue_2319_1: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -346,7 +309,7 @@ issue_2319_1: { issue_2319_2: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -371,7 +334,7 @@ issue_2319_2: { issue_2319_3: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -396,7 +359,7 @@ issue_2319_3: { issue_2425_1: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -419,7 +382,7 @@ issue_2425_1: { issue_2425_2: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -442,7 +405,7 @@ issue_2425_2: { issue_2425_3: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -465,7 +428,7 @@ issue_2425_3: { issue_2436_13: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_vars: true, unused: true, @@ -499,7 +462,7 @@ issue_2436_13: { issue_2506: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_vars: true, unused: true, @@ -538,7 +501,7 @@ issue_2506: { issue_2226_1: { options = { - keep_fargs: "strict", + keep_fargs: false, side_effects: true, unused: true, } @@ -585,7 +548,7 @@ issue_2226_1: { issue_2226_2: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, sequences: true, side_effects: true, unused: true, @@ -607,7 +570,7 @@ issue_2226_2: { issue_2226_3: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, side_effects: true, unused: true, } @@ -627,7 +590,7 @@ issue_2226_3: { issue_3192: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -657,7 +620,7 @@ issue_3192: { if_increment: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } @@ -679,7 +642,7 @@ if_increment: { try_increment: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } @@ -703,7 +666,7 @@ try_increment: { issue_2630_3: { options = { inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } @@ -740,7 +703,7 @@ issue_2630_3: { issue_3364: { options = { functions: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, toplevel: true, unused: true, @@ -805,7 +768,7 @@ issue_3364: { defun_label: { options = { - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_funcs: true, reduce_vars: true, @@ -837,7 +800,7 @@ defun_label: { iife_func_side_effects: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_funcs: true, reduce_vars: true, unused: true, @@ -889,7 +852,7 @@ iife_func_side_effects: { issue_1595_1: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_funcs: true, reduce_vars: true, unused: true, @@ -909,7 +872,7 @@ issue_1595_1: { issue_1595_2: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_funcs: true, reduce_vars: true, unused: true, @@ -929,7 +892,7 @@ issue_1595_2: { issue_1595_3: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_funcs: true, reduce_vars: true, @@ -950,7 +913,7 @@ issue_1595_3: { issue_1595_4: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, reduce_funcs: true, reduce_vars: true, unused: true, @@ -972,7 +935,7 @@ issue_1595_4: { duplicate_lambda_defun_name_1: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, } input: { @@ -992,7 +955,7 @@ duplicate_lambda_defun_name_1: { duplicate_lambda_defun_name_2: { options = { - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_vars: true, unused: true, @@ -1013,7 +976,7 @@ duplicate_lambda_defun_name_2: { function_name_mangle: { options = { - keep_fargs: "strict", + keep_fargs: false, keep_fnames: true, reduce_vars: true, unused: true, @@ -1031,7 +994,7 @@ function_name_mangle: { function_name_mangle_ie8: { options = { - keep_fargs: "strict", + keep_fargs: false, keep_fnames: true, reduce_vars: true, unused: true, @@ -1052,7 +1015,7 @@ function_name_mangle_ie8: { issue_3420_1: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -1075,7 +1038,7 @@ issue_3420_1: { issue_3420_2: { options = { inline: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -1096,7 +1059,7 @@ issue_3420_2: { issue_3420_3: { options = { inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } @@ -1118,7 +1081,7 @@ issue_3420_3: { issue_3423_1: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -1138,7 +1101,7 @@ issue_3423_1: { issue_3423_2: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -1165,7 +1128,7 @@ collapse_vars_repeated: { hoist_funs: true, if_return: true, join_vars: true, - keep_fargs: "strict", + keep_fargs: false, loops: true, properties: true, reduce_funcs: true, @@ -1212,7 +1175,7 @@ collapse_vars_repeated: { chained_3: { options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -1236,7 +1199,7 @@ replace_all_var_scope: { rename = true options = { collapse_vars: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } mangle = {} @@ -1265,7 +1228,7 @@ replace_all_var_scope: { issue_1583: { options = { - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_funcs: true, reduce_vars: true, @@ -1302,7 +1265,7 @@ issues_3267_1: { dead_code: true, evaluate: true, inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, sequences: true, side_effects: true, @@ -1331,7 +1294,7 @@ issues_3267_1: { trailing_argument_side_effects: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -1355,7 +1318,7 @@ trailing_argument_side_effects: { recursive_iife_1: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } @@ -1374,7 +1337,7 @@ recursive_iife_1: { recursive_iife_2: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } @@ -1455,7 +1418,7 @@ issue_3619: { issue_4353_1: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } @@ -1470,7 +1433,7 @@ issue_4353_1: { issue_4353_2: { options = { - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, unused: true, } diff --git a/test/compress/loops.js b/test/compress/loops.js index acbc8269..d76e7f74 100644 --- a/test/compress/loops.js +++ b/test/compress/loops.js @@ -1026,7 +1026,7 @@ issue_4075: { issue_4082: { options = { - keep_fargs: "strict", + keep_fargs: false, loops: true, unused: true, } @@ -1050,7 +1050,7 @@ issue_4082: { issue_4084: { options = { - keep_fargs: "strict", + keep_fargs: false, loops: true, passes: 2, reduce_vars: true, diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js index 1841e3db..1212be93 100644 --- a/test/compress/merge_vars.js +++ b/test/compress/merge_vars.js @@ -327,7 +327,7 @@ issue_4103: { issue_4107: { options = { - keep_fargs: "strict", + keep_fargs: false, merge_vars: true, reduce_vars: true, unused: true, diff --git a/test/compress/pure_funcs.js b/test/compress/pure_funcs.js index 09f0bd45..6467102b 100644 --- a/test/compress/pure_funcs.js +++ b/test/compress/pure_funcs.js @@ -685,7 +685,7 @@ issue_3858: { options = { collapse_vars: true, inline: true, - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { @@ -711,7 +711,7 @@ inline_pure_call_1: { options = { collapse_vars: true, inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, sequences: true, side_effects: true, @@ -733,7 +733,7 @@ inline_pure_call_2: { options = { collapse_vars: true, inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, sequences: true, side_effects: true, @@ -756,7 +756,7 @@ inline_pure_call_3: { collapse_vars: true, evaluate: true, inline: true, - keep_fargs: "strict", + keep_fargs: false, passes: 2, reduce_vars: true, toplevel: true, diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 838b130a..ea9efee0 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -2373,7 +2373,7 @@ redefine_farg_1: { function f(a) { return typeof a; } - function g() { + function g(a) { return "number"; } function h(a, b) { @@ -6928,7 +6928,7 @@ issue_3622: { options = { evaluate: true, inline: true, - keep_fargs: "strict", + keep_fargs: false, reduce_vars: true, sequences: true, toplevel: true, @@ -7196,7 +7196,7 @@ issue_3894: { issue_3922: { options = { evaluate: true, - keep_fargs: "strict", + keep_fargs: false, pure_getters: "strict", reduce_vars: true, side_effects: true, diff --git a/test/compress/side_effects.js b/test/compress/side_effects.js index 6428b172..2a65bc24 100644 --- a/test/compress/side_effects.js +++ b/test/compress/side_effects.js @@ -436,7 +436,7 @@ trim_new: { issue_4325: { options = { - keep_fargs: "strict", + keep_fargs: false, passes: 2, pure_getters: "strict", reduce_vars: true, diff --git a/test/compress/spread.js b/test/compress/spread.js index 41715514..67aa549a 100644 --- a/test/compress/spread.js +++ b/test/compress/spread.js @@ -192,7 +192,7 @@ keep_property_access: { keep_fargs: { options = { - keep_fargs: "strict", + keep_fargs: false, unused: true, } input: { diff --git a/test/input/reduce/diff_error.js b/test/input/reduce/diff_error.js index ba267c5c..467ee599 100644 --- a/test/input/reduce/diff_error.js +++ b/test/input/reduce/diff_error.js @@ -1,5 +1,5 @@ -(function f(a) { - do { - console.log(f.length); - } while (console.log(f += 0)); -})(); +console.log(function(undefined) { + return undefined[function() { + {} + }] || 1 + .1 + .1; +}(42)); diff --git a/test/input/reduce/diff_error.reduced.js b/test/input/reduce/diff_error.reduced.js index a76e3d94..3002460b 100644 --- a/test/input/reduce/diff_error.reduced.js +++ b/test/input/reduce/diff_error.reduced.js @@ -1,19 +1,14 @@ // (beautified) -(function f(a) { - do { - console.log(f.length); - } while (console.log(f += 0)); -})(); -// output: 1 -// function(){}0 +console.log(function() { + return 1 + .1 + .1; +}()); +// output: 1.2000000000000002 // -// minify: 0 -// function(){}0 +// minify: 1.2 // // options: { // "compress": { -// "keep_fargs": false, -// "unsafe": true +// "unsafe_math": true // }, // "mangle": false // }
\ No newline at end of file diff --git a/test/input/reduce/setter.js b/test/input/reduce/setter.js index 87228bc4..61ba5952 100644 --- a/test/input/reduce/setter.js +++ b/test/input/reduce/setter.js @@ -1,8 +1,5 @@ -console.log(function f(a) { - ({ - set p(v) { - f++; - } - }); - return f.length; -}()); +({ + set p(v) { + console.log(+v + .1 + .1); + } +}).p = 1; diff --git a/test/input/reduce/setter.reduced.js b/test/input/reduce/setter.reduced.js index e0a3c626..68d5f366 100644 --- a/test/input/reduce/setter.reduced.js +++ b/test/input/reduce/setter.reduced.js @@ -1,20 +1,16 @@ // (beautified) -console.log(function f(a) { - ({ - set p(v) { - f++; - } - }); - return f.length; -}()); -// output: 1 +({ + set p(v) { + console.log(1 + .1 + .1); + } +}).p = 0; +// output: 1.2000000000000002 // -// minify: 0 +// minify: 1.2 // // options: { // "compress": { -// "keep_fargs": false, -// "unsafe": true +// "unsafe_math": true // }, // "mangle": false // }
\ No newline at end of file diff --git a/test/mocha/reduce.js b/test/mocha/reduce.js index c06efd67..ce931fe9 100644 --- a/test/mocha/reduce.js +++ b/test/mocha/reduce.js @@ -37,8 +37,7 @@ describe("test/reduce.js", function() { it("Should retain setter arguments", function() { var result = reduce_test(read("test/input/reduce/setter.js"), { compress: { - keep_fargs: false, - unsafe: true, + unsafe_math: true, }, mangle: false, }, { @@ -110,28 +109,24 @@ describe("test/reduce.js", function() { }); it("Should print correct output for irreducible test case", function() { var result = reduce_test([ - "console.log(function f(a) {", - " return f.length;", - "}());", + "console.log(1 + .1 + .1);", ].join("\n"), { compress: { - keep_fargs: false, + unsafe_math: true, }, mangle: false, }); if (result.error) throw result.error; assert.strictEqual(result.code, [ "// (beautified)", - "console.log(function f(a) {", - " return f.length;", - "}());", - "// output: 1", + "console.log(1 + .1 + .1);", + "// output: 1.2000000000000002", "// ", - "// minify: 0", + "// minify: 1.2", "// ", "// options: {", '// "compress": {', - '// "keep_fargs": false', + '// "unsafe_math": true', "// },", '// "mangle": false', "// }", @@ -303,8 +298,7 @@ describe("test/reduce.js", function() { if (semver.satisfies(process.version, "<=0.10")) return; var result = reduce_test(read("test/input/reduce/diff_error.js"), { compress: { - keep_fargs: false, - unsafe: true, + unsafe_math: true, }, mangle: false, }, { diff --git a/test/ufuzz/options.json b/test/ufuzz/options.json index d20741a8..1bdfd5b6 100644 --- a/test/ufuzz/options.json +++ b/test/ufuzz/options.json @@ -28,7 +28,6 @@ }, { "compress": { - "keep_fargs": false, "passes": 1e6, "sequences": 1e6, "unsafe": true, |