aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-12-01 12:52:36 +0800
committerGitHub <noreply@github.com>2017-12-01 12:52:36 +0800
commit09b320e8a5ec85410bf323573b76f2da7e08e2ee (patch)
treeff9ab90c53922d43b709f79c8bb0e6c53ece4219 /test
parent5a1e99d713fd0ca4ca4a012422a767c138a75606 (diff)
downloadtracifyjs-09b320e8a5ec85410bf323573b76f2da7e08e2ee.tar.gz
tracifyjs-09b320e8a5ec85410bf323573b76f2da7e08e2ee.zip
convert to number under boolean context (#2545)
Diffstat (limited to 'test')
-rw-r--r--test/compress/conditionals.js4
-rw-r--r--test/compress/issue-1639.js4
-rw-r--r--test/compress/issue-637.js2
-rw-r--r--test/compress/issue-640.js2
-rw-r--r--test/compress/reduce_vars.js2
-rw-r--r--test/compress/transform.js6
-rw-r--r--test/compress/typeof.js4
7 files changed, 12 insertions, 12 deletions
diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js
index 9cb27fa5..22947d86 100644
--- a/test/compress/conditionals.js
+++ b/test/compress/conditionals.js
@@ -1037,10 +1037,10 @@ issue_2535: {
expect: {
y();
x() && y();
- (x(), 0) || y();
+ (x(), 1) && y();
x() && y();
x() && y();
x() && y();
- (x(), 1) || y();
+ (x(), 0) && y();
}
}
diff --git a/test/compress/issue-1639.js b/test/compress/issue-1639.js
index b6a9647f..fc3db983 100644
--- a/test/compress/issue-1639.js
+++ b/test/compress/issue-1639.js
@@ -26,7 +26,7 @@ issue_1639_1: {
}
expect: {
for (var a = 100, b = 10, L1 = 5; --L1 > 0;)
- if (--b, !1) var ignore = 0;
+ if (--b, 0) var ignore = 0;
console.log(a, b);
}
expect_stdout: true
@@ -57,7 +57,7 @@ issue_1639_2: {
expect: {
var a = 100, b = 10;
function f19() {
- ++a, 1;
+ ++a, 0;
}
f19(),
console.log(a, b);
diff --git a/test/compress/issue-637.js b/test/compress/issue-637.js
index 45fd2481..ed42cb8e 100644
--- a/test/compress/issue-637.js
+++ b/test/compress/issue-637.js
@@ -17,6 +17,6 @@ wrongly_optimized: {
foo();
}
// TODO: optimize to `func(), bar()`
- (func(), 0) || bar();
+ (func(), 1) && bar();
}
}
diff --git a/test/compress/issue-640.js b/test/compress/issue-640.js
index c9a68dc9..784092c8 100644
--- a/test/compress/issue-640.js
+++ b/test/compress/issue-640.js
@@ -100,7 +100,7 @@ wrongly_optimized: {
foo();
}
// TODO: optimize to `func(), bar()`
- if (func(), !0) bar();
+ if (func(), 1) bar();
}
}
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index bcfa7b35..4a098f78 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -2347,7 +2347,7 @@ booleans: {
}
expect: {
console.log(function(a) {
- if (!1);
+ if (0);
switch (!1) {
case 0:
return "FAIL";
diff --git a/test/compress/transform.js b/test/compress/transform.js
index 1e21da5b..68d33844 100644
--- a/test/compress/transform.js
+++ b/test/compress/transform.js
@@ -45,9 +45,9 @@ condition_evaluate: {
if (void 0 == null);
}
expect: {
- while (!1);
- for (; !0;);
- if (!0);
+ while (0);
+ for (; 1;);
+ if (1);
}
}
diff --git a/test/compress/typeof.js b/test/compress/typeof.js
index 60f3d1d0..34949fbe 100644
--- a/test/compress/typeof.js
+++ b/test/compress/typeof.js
@@ -44,7 +44,7 @@ typeof_in_boolean_context: {
function f2() { return g(), "Yes"; }
foo();
console.log(1);
- var a = !(console.log(2), !0);
+ var a = !(console.log(2), 1);
foo();
}
}
@@ -57,6 +57,6 @@ issue_1668: {
if (typeof bar);
}
expect: {
- if (!0);
+ if (1);
}
}