diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-17 13:58:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-17 13:58:27 +0800 |
commit | 79cfac77bdee04021db9f60111f55005919f7b67 (patch) | |
tree | cb15ad41971a9825ea40e26631dfa2aa8cbf8836 /test/compress/properties.js | |
parent | 224c14d49d0f007af641b8c7d358814634ea7c5f (diff) | |
download | tracifyjs-79cfac77bdee04021db9f60111f55005919f7b67.tar.gz tracifyjs-79cfac77bdee04021db9f60111f55005919f7b67.zip |
extend `join_vars` & `sequences` (#2798)
Diffstat (limited to 'test/compress/properties.js')
-rw-r--r-- | test/compress/properties.js | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/test/compress/properties.js b/test/compress/properties.js index 7df53d39..933774d5 100644 --- a/test/compress/properties.js +++ b/test/compress/properties.js @@ -1189,7 +1189,7 @@ join_object_assignments_3: { expect_stdout: "PASS" } -join_object_assignments_4: { +join_object_assignments_return_1: { options = { join_vars: true, } @@ -1213,7 +1213,7 @@ join_object_assignments_4: { expect_stdout: "foo" } -join_object_assignments_5: { +join_object_assignments_return_2: { options = { join_vars: true, } @@ -1239,7 +1239,7 @@ join_object_assignments_5: { expect_stdout: "bar" } -join_object_assignments_6: { +join_object_assignments_return_3: { options = { join_vars: true, } @@ -1271,7 +1271,7 @@ join_object_assignments_6: { ] } -join_object_assignments_7: { +join_object_assignments_for: { options = { join_vars: true, } @@ -1298,3 +1298,43 @@ join_object_assignments_7: { "3", ] } + +join_object_assignments_if: { + options = { + join_vars: true, + } + input: { + console.log(function() { + var o = {}; + if (o.a = "PASS") return o.a; + }()) + } + expect: { + console.log(function() { + var o = { a: "PASS" }; + if (o.a) return o.a; + }()); + } + expect_stdout: "PASS" +} + +join_object_assignments_forin: { + options = { + join_vars: true, + } + input: { + console.log(function() { + var o = {}; + for (var a in o.a = "PASS", o) + return o[a]; + }()) + } + expect: { + console.log(function() { + var o = { a: "PASS" }; + for (var a in o) + return o[a]; + }()); + } + expect_stdout: "PASS" +} |