From bbb5832122c41dcc06193225b570ff7dcd4030b9 Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Thu, 7 Dec 2017 22:38:01 +0800 Subject: [PATCH] add test --- test/compress/conditionals.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js index 8734a66e..c72768af 100644 --- a/test/compress/conditionals.js +++ b/test/compress/conditionals.js @@ -609,6 +609,36 @@ cond_8c: { } } +cond_9: { + options = { + conditionals: true, + } + input: { + function f(x, y) { + x ? y(a, b, c) : y(a, b, c); + x ? y(a, b, c) : y(a, b, f); + x ? y(a, b, c) : y(a, e, c); + x ? y(a, b, c) : y(a, e, f); + x ? y(a, b, c) : y(d, b, c); + x ? y(a, b, c) : y(d, b, f); + x ? y(a, b, c) : y(d, e, c); + x ? y(a, b, c) : y(d, e, f); + } + } + expect: { + function f(x, y) { + x, y(a, b, c); + y(a, b, x ? c : f); + y(a, x ? b : e, c); + x ? y(a, b, c) : y(a, e, f); + y(x ? a : d, b, c); + x ? y(a, b, c) : y(d, b, f); + x ? y(a, b, c) : y(d, e, c); + x ? y(a, b, c) : y(d, e, f); + } + } +} + ternary_boolean_consequent: { options = { collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,