aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-15 15:59:10 +0100
committerGitHub <noreply@github.com>2020-09-15 22:59:10 +0800
commita62b086184e70072929a218d97dd11ce8efdfaff (patch)
tree9d0019815bb7c8ae2d4af8d25db7ab83f40765dd /test
parent335456cf7766938be44e08102efffc94c6cbd07c (diff)
downloadtracifyjs-a62b086184e70072929a218d97dd11ce8efdfaff.tar.gz
tracifyjs-a62b086184e70072929a218d97dd11ce8efdfaff.zip
enhance `merge_vars` (#4105)
Diffstat (limited to 'test')
-rw-r--r--test/compress/merge_vars.js37
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,