diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/drop-unused.js | 57 | ||||
-rw-r--r-- | test/compress/functions.js | 3 |
2 files changed, 58 insertions, 2 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index 6ab4fe3b..052a013b 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2848,3 +2848,60 @@ issue_4025: { "1 1 1", ] } + +forin_var_1: { + options = { + unused: true, + } + input: { + var k; + for (k in [ 1, 2 ]) + console.log(k); + for (k in { PASS: 3 }) + console.log(k); + console.log(k); + } + expect: { + for (var k in [ 1, 2 ]) + console.log(k); + for (k in { PASS: 3 }) + console.log(k); + console.log(k); + } + expect_stdout: [ + "0", + "1", + "PASS", + "PASS", + ] +} + +forin_var_2: { + options = { + unused: true, + } + input: { + console.log(function() { + switch (0) { + case function() { + for (a in 0); + }: + var b = 0; + } + for (var c = 0; a;); + var a; + }()); + } + expect: { + console.log(function() { + switch (0) { + case function() { + for (a in 0); + }: + } + for (; a;); + var a; + }()); + } + expect_stdout: "undefined" +} diff --git a/test/compress/functions.js b/test/compress/functions.js index 18f4f900..8bfb2eaf 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -1483,8 +1483,7 @@ issue_2663_2: { } expect: { (function() { - var i; - for (i in { a: 1, b: 2, c: 3 }) + for (var i in { a: 1, b: 2, c: 3 }) j = i, console.log(j); var j; })(); |