aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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,