diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-04 16:43:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 23:43:49 +0800 |
commit | 66140b459e65e0540e567966f8dbefdbc2016f9e (patch) | |
tree | b1a5911f86bf4887e38bc425a4d43165de13d722 /test | |
parent | 1786c6907070ee984d36548ab9941f36c524237e (diff) | |
download | tracifyjs-66140b459e65e0540e567966f8dbefdbc2016f9e.tar.gz tracifyjs-66140b459e65e0540e567966f8dbefdbc2016f9e.zip |
enhance `side_effects` (#4175)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/properties.js | 6 | ||||
-rw-r--r-- | test/compress/side_effects.js | 17 | ||||
-rw-r--r-- | test/input/issue-3294/output.js | 4 | ||||
-rw-r--r-- | test/input/issue-520/output.js | 4 |
4 files changed, 22 insertions, 9 deletions
diff --git a/test/compress/properties.js b/test/compress/properties.js index 169dcd11..43f08b42 100644 --- a/test/compress/properties.js +++ b/test/compress/properties.js @@ -1123,11 +1123,7 @@ new_this: { } }.f(42); } - expect: { - new function(a) { - this.a = a; - }(42); - } + expect: {} } issue_2513: { diff --git a/test/compress/side_effects.js b/test/compress/side_effects.js index 0746a56d..3c53dd25 100644 --- a/test/compress/side_effects.js +++ b/test/compress/side_effects.js @@ -416,3 +416,20 @@ issue_4008: { "PASS", ] } + +trim_new: { + options = { + side_effects: true, + } + input: { + new function(a) { + console.log(a); + }("PASS"); + } + expect: { + (function(a) { + console.log(a); + })("PASS"); + } + expect_stdout: "PASS" +} diff --git a/test/input/issue-3294/output.js b/test/input/issue-3294/output.js index 33efadb6..2e847e1b 100644 --- a/test/input/issue-3294/output.js +++ b/test/input/issue-3294/output.js @@ -1,2 +1,2 @@ -new function(){console.log(3)}; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sInNvdXJjZXNDb250ZW50IjpbImNsYXNzIEZvbyB7IGNvbnN0cnVjdG9yKCl7Y29uc29sZS5sb2coMSsyKTt9IH0gbmV3IEZvbygpO1xuIl0sIm5hbWVzIjpbImNvbnNvbGUiLCJsb2ciXSwibWFwcGluZ3MiOiJBQUErQyxJQUFyQyxXQUFnQkEsUUFBUUMsSUFBSSJ9 +console.log(3); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sInNvdXJjZXNDb250ZW50IjpbImNsYXNzIEZvbyB7IGNvbnN0cnVjdG9yKCl7Y29uc29sZS5sb2coMSsyKTt9IH0gbmV3IEZvbygpO1xuIl0sIm5hbWVzIjpbImNvbnNvbGUiLCJsb2ciXSwibWFwcGluZ3MiOiJBQUEwQkEsUUFBUUMsSUFBSSJ9 diff --git a/test/input/issue-520/output.js b/test/input/issue-520/output.js index 33efadb6..2e847e1b 100644 --- a/test/input/issue-520/output.js +++ b/test/input/issue-520/output.js @@ -1,2 +1,2 @@ -new function(){console.log(3)}; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sInNvdXJjZXNDb250ZW50IjpbImNsYXNzIEZvbyB7IGNvbnN0cnVjdG9yKCl7Y29uc29sZS5sb2coMSsyKTt9IH0gbmV3IEZvbygpO1xuIl0sIm5hbWVzIjpbImNvbnNvbGUiLCJsb2ciXSwibWFwcGluZ3MiOiJBQUErQyxJQUFyQyxXQUFnQkEsUUFBUUMsSUFBSSJ9 +console.log(3); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sInNvdXJjZXNDb250ZW50IjpbImNsYXNzIEZvbyB7IGNvbnN0cnVjdG9yKCl7Y29uc29sZS5sb2coMSsyKTt9IH0gbmV3IEZvbygpO1xuIl0sIm5hbWVzIjpbImNvbnNvbGUiLCJsb2ciXSwibWFwcGluZ3MiOiJBQUEwQkEsUUFBUUMsSUFBSSJ9 |