aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2014-02-07 11:31:11 +0200
committerMihai Bazon <mihai.bazon@gmail.com>2014-02-07 11:31:11 +0200
commit1a4440080dd2632eb47ee446058fa01ad76c6e9b (patch)
treea973ca73381fd01faa5c720936616954521ecea2 /test
parent2494daaf687c9a07d16f37c74213b95f02341649 (diff)
parentac0086a74521ffce97b6e8bde0bee54feb0c5ec9 (diff)
downloadtracifyjs-1a4440080dd2632eb47ee446058fa01ad76c6e9b.tar.gz
tracifyjs-1a4440080dd2632eb47ee446058fa01ad76c6e9b.zip
Merge pull request #424 from mattbasta/simplify_conditionals
Simplify nested conditionals if possible
Diffstat (limited to 'test')
-rw-r--r--test/compress/conditionals.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js
index 9ef30ac1..213b246b 100644
--- a/test/compress/conditionals.js
+++ b/test/compress/conditionals.js
@@ -205,3 +205,30 @@ cond_4: {
some_condition(), do_something();
}
}
+
+cond_5: {
+ options = {
+ conditionals: true
+ };
+ input: {
+ if (some_condition()) {
+ if (some_other_condition()) {
+ do_something();
+ } else {
+ alternate();
+ }
+ } else {
+ alternate();
+ }
+
+ if (some_condition()) {
+ if (some_other_condition()) {
+ do_something();
+ }
+ }
+ }
+ expect: {
+ some_condition() && some_other_condition() ? do_something() : alternate();
+ some_condition() && some_other_condition() && do_something();
+ }
+}