aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/conditionals.js204
1 files changed, 199 insertions, 5 deletions
diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js
index 16ef6d66..65cfea64 100644
--- a/test/compress/conditionals.js
+++ b/test/compress/conditionals.js
@@ -332,53 +332,247 @@ cond_7_1: {
cond_8: {
options = {
conditionals: true,
- evaluate : true
+ evaluate : true,
+ booleans : false
};
input: {
var a;
// compress these
a = condition ? true : false;
-
a = !condition ? true : false;
-
a = condition() ? true : false;
+ a = condition ? !0 : !1;
+ a = !condition ? !null : !2;
+ a = condition() ? !0 : !-3.5;
+
if (condition) {
a = true;
} else {
a = false;
}
- a = condition ? false : true;
+ if (condition) {
+ a = !0;
+ } else {
+ a = !1;
+ }
+ a = condition ? false : true;
a = !condition ? false : true;
-
a = condition() ? false : true;
+ a = condition ? !3 : !0;
+ a = !condition ? !2 : !0;
+ a = condition() ? !1 : !0;
+
if (condition) {
a = false;
} else {
a = true;
}
+ if (condition) {
+ a = !1;
+ } else {
+ a = !0;
+ }
+
// don't compress these
a = condition ? 1 : false;
+ a = !condition ? true : 0;
+ a = condition ? 1 : 0;
+ }
+ expect: {
+ var a;
+ a = !!condition;
+ a = !condition;
+ a = !!condition();
+
+ a = !!condition;
+ a = !condition;
+ a = !!condition();
+
+ a = !!condition;
+ a = !!condition;
+
+ a = !condition;
+ a = !!condition;
+ a = !condition();
+
+ a = !condition;
+ a = !!condition;
+ a = !condition();
+
+ a = !condition;
+ a = !condition;
+
+ a = condition ? 1 : false;
+ a = condition ? 0 : true;
+ a = condition ? 1 : 0;
+ }
+}
+cond_8b: {
+ options = {
+ conditionals: true,
+ evaluate : true,
+ booleans : true
+ };
+ input: {
+ var a;
+ // compress these
+ a = condition ? true : false;
+ a = !condition ? true : false;
+ a = condition() ? true : false;
+
+ a = condition ? !0 : !1;
+ a = !condition ? !null : !2;
+ a = condition() ? !0 : !-3.5;
+
+ if (condition) {
+ a = true;
+ } else {
+ a = false;
+ }
+
+ if (condition) {
+ a = !0;
+ } else {
+ a = !1;
+ }
+
+ a = condition ? false : true;
+ a = !condition ? false : true;
+ a = condition() ? false : true;
+
+ a = condition ? !3 : !0;
+ a = !condition ? !2 : !0;
+ a = condition() ? !1 : !0;
+
+ if (condition) {
+ a = false;
+ } else {
+ a = true;
+ }
+
+ if (condition) {
+ a = !1;
+ } else {
+ a = !0;
+ }
+
+ a = condition ? 1 : false;
a = !condition ? true : 0;
+ a = condition ? 1 : 0;
+ }
+ expect: {
+ var a;
+ a = !!condition;
+ a = !condition;
+ a = !!condition();
+ a = !!condition;
+ a = !condition;
+ a = !!condition();
+
+ a = !!condition;
+ a = !!condition;
+
+ a = !condition;
+ a = !!condition;
+ a = !condition();
+
+ a = !condition;
+ a = !!condition;
+ a = !condition();
+
+ a = !condition;
+ a = !condition;
+
+ a = condition ? 1 : !1;
+ a = condition ? 0 : !0;
a = condition ? 1 : 0;
+ }
+}
+
+cond_8c: {
+ options = {
+ conditionals: true,
+ evaluate : false,
+ booleans : false
+ };
+ input: {
+ var a;
+ // compress these
+ a = condition ? true : false;
+ a = !condition ? true : false;
+ a = condition() ? true : false;
+ a = condition ? !0 : !1;
+ a = !condition ? !null : !2;
+ a = condition() ? !0 : !-3.5;
+
+ if (condition) {
+ a = true;
+ } else {
+ a = false;
+ }
+
+ if (condition) {
+ a = !0;
+ } else {
+ a = !1;
+ }
+
+ a = condition ? false : true;
+ a = !condition ? false : true;
+ a = condition() ? false : true;
+
+ a = condition ? !3 : !0;
+ a = !condition ? !2 : !0;
+ a = condition() ? !1 : !0;
+
+ if (condition) {
+ a = false;
+ } else {
+ a = true;
+ }
+
+ if (condition) {
+ a = !1;
+ } else {
+ a = !0;
+ }
+
+ a = condition ? 1 : false;
+ a = !condition ? true : 0;
+ a = condition ? 1 : 0;
}
expect: {
var a;
a = !!condition;
a = !condition;
a = !!condition();
+
+ a = !!condition;
+ a = !condition;
+ a = condition() ? !0 : !-3.5;
+
+ a = !!condition;
+ a = !!condition;
+
+ a = !condition;
a = !!condition;
+ a = !condition();
+
a = !condition;
a = !!condition;
a = !condition();
+
a = !condition;
+ a = !condition;
+
a = condition ? 1 : false;
a = condition ? 0 : true;
a = condition ? 1 : 0;