aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/conditionals.js96
1 files changed, 96 insertions, 0 deletions
diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js
index 074d2a65..7c81cc80 100644
--- a/test/compress/conditionals.js
+++ b/test/compress/conditionals.js
@@ -797,3 +797,99 @@ no_evaluate: {
}
}
}
+
+equality_conditionals_false: {
+ options = {
+ conditionals: false,
+ sequences: true,
+ }
+ input: {
+ function f(a, b, c) {
+ console.log(
+ a == (b ? a : a),
+ a == (b ? a : c),
+ a != (b ? a : a),
+ a != (b ? a : c),
+ a === (b ? a : a),
+ a === (b ? a : c),
+ a !== (b ? a : a),
+ a !== (b ? a : c)
+ );
+ }
+ f(0, 0, 0);
+ f(0, true, 0);
+ f(1, 2, 3);
+ f(1, null, 3);
+ f(NaN);
+ f(NaN, "foo");
+ }
+ expect: {
+ function f(a, b, c) {
+ console.log(
+ a == (b ? a : a),
+ a == (b ? a : c),
+ a != (b ? a : a),
+ a != (b ? a : c),
+ a === (b ? a : a),
+ a === (b ? a : c),
+ a !== (b ? a : a),
+ a !== (b ? a : c)
+ );
+ }
+ f(0, 0, 0),
+ f(0, true, 0),
+ f(1, 2, 3),
+ f(1, null, 3),
+ f(NaN),
+ f(NaN, "foo");
+ }
+ expect_stdout: true
+}
+
+equality_conditionals_true: {
+ options = {
+ conditionals: true,
+ sequences: true,
+ }
+ input: {
+ function f(a, b, c) {
+ console.log(
+ a == (b ? a : a),
+ a == (b ? a : c),
+ a != (b ? a : a),
+ a != (b ? a : c),
+ a === (b ? a : a),
+ a === (b ? a : c),
+ a !== (b ? a : a),
+ a !== (b ? a : c)
+ );
+ }
+ f(0, 0, 0);
+ f(0, true, 0);
+ f(1, 2, 3);
+ f(1, null, 3);
+ f(NaN);
+ f(NaN, "foo");
+ }
+ expect: {
+ function f(a, b, c) {
+ console.log(
+ (b, a == a),
+ a == (b ? a : c),
+ (b, a != a),
+ a != (b ? a : c),
+ (b, a === a),
+ a === (b ? a : c),
+ (b, a !== a),
+ a !== (b ? a : c)
+ );
+ }
+ f(0, 0, 0),
+ f(0, true, 0),
+ f(1, 2, 3),
+ f(1, null, 3),
+ f(NaN),
+ f(NaN, "foo");
+ }
+ expect_stdout: true
+}