diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-09-15 15:59:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 22:59:10 +0800 |
commit | a62b086184e70072929a218d97dd11ce8efdfaff (patch) | |
tree | 9d0019815bb7c8ae2d4af8d25db7ab83f40765dd /test | |
parent | 335456cf7766938be44e08102efffc94c6cbd07c (diff) | |
download | tracifyjs-a62b086184e70072929a218d97dd11ce8efdfaff.tar.gz tracifyjs-a62b086184e70072929a218d97dd11ce8efdfaff.zip |
enhance `merge_vars` (#4105)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/merge_vars.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js index 6923fe73..4c5f6dac 100644 --- a/test/compress/merge_vars.js +++ b/test/compress/merge_vars.js @@ -76,6 +76,43 @@ merge_toplevel: { ] } +segment: { + options = { + merge_vars: true, + toplevel: true, + } + input: { + var a = "foo"; + console.log(a); + for (var c, i = 0; i < 1; i++) { + var b = "bar"; + console.log(b); + c = "baz"; + console.log(c); + } + var d = "moo"; + console.log(d); + } + expect: { + var d = "foo"; + console.log(d); + for (var c, i = 0; i < 1; i++) { + var c = "bar"; + console.log(c); + c = "baz"; + console.log(c); + } + var d = "moo"; + console.log(d); + } + expect_stdout: [ + "foo", + "bar", + "baz", + "moo", + ] +} + init_scope_vars: { options = { merge_vars: true, |