diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-05-07 07:36:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 07:36:25 +0800 |
commit | df8a99439a3cab07670fd462ad2f8d6d240a8312 (patch) | |
tree | d8e4d2a92fbba72cf276d41d43eed44aca690419 /test/compress | |
parent | 6b91d12ec352ad0494752aa6a74ee16cc99b5158 (diff) | |
download | tracifyjs-df8a99439a3cab07670fd462ad2f8d6d240a8312.tar.gz tracifyjs-df8a99439a3cab07670fd462ad2f8d6d240a8312.zip |
fix various corner cases (#3126)
- augment ufuzz/reminify test options
fixes #3125
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/functions.js | 16 | ||||
-rw-r--r-- | test/compress/reduce_vars.js | 88 |
2 files changed, 104 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 650254f4..29a26573 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -2303,3 +2303,19 @@ issue_3076: { } expect_stdout: "PASS" } + +issue_3125: { + options = { + inline: true, + unsafe: true, + } + input: { + console.log(function() { + return "PASS"; + }.call()); + } + expect: { + console.log("PASS"); + } + expect_stdout: "PASS" +} diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index e47b96b5..bc5fcf1b 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -6058,3 +6058,91 @@ conditional_nested_2: { } expect_stdout: "1" } + +issue_2436: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + unsafe: true, + } + input: { + var c; + console.log(((c = { + a: 1, + b: 2 + }).a = 3, { + x: c.a, + y: c.b + })); + } + expect: { + var c; + console.log(((c = { + a: 1, + b: 2 + }).a = 3, { + x: c.a, + y: c.b + })); + } + expect_stdout: true +} + +issue_2916: { + options = { + collapse_vars: true, + evaluate: true, + inline: true, + passes: 2, + reduce_vars: true, + side_effects: true, + unsafe: true, + unused: true, + } + input: { + var c = "FAIL"; + (function(b) { + (function(d) { + d[0] = 1; + })(b); + +b && (c = "PASS"); + })([]); + console.log(c); + } + expect: { + var c = "FAIL"; + (function(b) { + b[0] = 1; + +b && (c = "PASS"); + })([]); + console.log(c); + } + expect_stdout: "PASS" +} + +issue_3125: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + unsafe: true, + } + input: { + var o; + console.log((function() { + this.p++; + }.call(o = { + p: 6 + }), o.p)); + } + expect: { + var o; + console.log((function() { + this.p++; + }.call(o = { + p: 6 + }), o.p)); + } + expect_stdout: "7" +} |