diff options
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/loops.js | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/test/compress/loops.js b/test/compress/loops.js index 91aa1c5f..78f618aa 100644 --- a/test/compress/loops.js +++ b/test/compress/loops.js @@ -144,4 +144,46 @@ parse_do_while_without_semicolon: { expect: { do x(); while (false);y(); } -}
\ No newline at end of file +} + + +keep_collapse_const_in_own_block_scope: { + options = { + join_vars: true, + loops: true + } + input: { + var i=2; + const c=5; + while(i--) + console.log(i); + console.log(c); + } + expect: { + var i=2; + const c=5; + for(;i--;) + console.log(i); + console.log(c); + } +} + +keep_collapse_const_in_own_block_scope_2: { + options = { + join_vars: true, + loops: true + } + input: { + const c=5; + var i=2; // Moves to loop, while it did not in previous test + while(i--) + console.log(i); + console.log(c); + } + expect: { + const c=5; + for(var i=2;i--;) + console.log(i); + console.log(c); + } +} |