aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2015-07-22 16:53:25 +0300
committerMihai Bazon <mihai.bazon@gmail.com>2015-07-22 16:55:55 +0300
commit905b6011784ca60d41919ac1a499962b7c1d4b02 (patch)
treeda15abdd808cefbb9ef794385dd0c5c397f51683 /test/compress
parent63fb2d5a44db3d583b1927c8daa244bf9f4d8dd2 (diff)
downloadtracifyjs-905b6011784ca60d41919ac1a499962b7c1d4b02.tar.gz
tracifyjs-905b6011784ca60d41919ac1a499962b7c1d4b02.zip
Don't attempt to negate non-boolean AST_Binary
Fix #751
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/issue-751.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/compress/issue-751.js b/test/compress/issue-751.js
new file mode 100644
index 00000000..829b7ca5
--- /dev/null
+++ b/test/compress/issue-751.js
@@ -0,0 +1,29 @@
+negate_booleans_1: {
+ options = {
+ comparisons: true
+ };
+ input: {
+ var a = !a || !b || !c || !d || !e || !f;
+ }
+ expect: {
+ var a = !(a && b && c && d && e && f);
+ }
+}
+
+negate_booleans_2: {
+ options = {
+ comparisons: true
+ };
+ input: {
+ var match = !x && // should not touch this one
+ (!z || c) &&
+ (!k || d) &&
+ the_stuff();
+ }
+ expect: {
+ var match = !x &&
+ (!z || c) &&
+ (!k || d) &&
+ the_stuff();
+ }
+}