aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-03-19 01:34:25 +0800
committerGitHub <noreply@github.com>2019-03-19 01:34:25 +0800
commitc520e99eda6a516ea275b58fc100eff378261145 (patch)
tree2c24f3634c9266b887efd05f0a5e281e9892f697 /test/compress
parent615ae37ca3a659df2ed304d7d30a43704fdd43ab (diff)
downloadtracifyjs-c520e99eda6a516ea275b58fc100eff378261145.tar.gz
tracifyjs-c520e99eda6a516ea275b58fc100eff378261145.zip
enhance `comparisons` (#3347)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/comparisons.js (renamed from test/compress/comparing.js)22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/comparing.js b/test/compress/comparisons.js
index 1ff29565..434f09c9 100644
--- a/test/compress/comparing.js
+++ b/test/compress/comparisons.js
@@ -323,3 +323,25 @@ is_number_unsafe: {
}
expect_stdout: "true"
}
+
+is_boolean_var: {
+ options = {
+ comparisons: true,
+ reduce_vars: true,
+ }
+ input: {
+ console.log(function(a, b) {
+ for (var i = 0, c = !b; i < a.length; i++)
+ if (!a[i] === c)
+ return i;
+ }([ false, true ], 42));
+ }
+ expect: {
+ console.log(function(a, b) {
+ for (var i = 0, c = !b; i < a.length; i++)
+ if (!a[i] == c)
+ return i;
+ }([ false, true ], 42));
+ }
+ expect_stdout: "1"
+}