diff options
Diffstat (limited to 'test/compress/issue-976.js')
-rw-r--r-- | test/compress/issue-976.js | 93 |
1 files changed, 66 insertions, 27 deletions
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", + ] } |