aboutsummaryrefslogtreecommitdiff
path: root/test/input/issue-1482
diff options
context:
space:
mode:
authoralexlamsl <alexlamsl@gmail.com>2017-02-18 19:30:33 +0800
committeralexlamsl <alexlamsl@gmail.com>2017-02-21 13:29:58 +0800
commit09f9ae2de9fb2a328e088ab82ad1e49731c971fb (patch)
treeca68b24b4a09542d4800547a14b13f4b96ead90c /test/input/issue-1482
parent7e6331bb397e1dec0a4e15233a2afca3a4e9daff (diff)
downloadtracifyjs-09f9ae2de9fb2a328e088ab82ad1e49731c971fb.tar.gz
tracifyjs-09f9ae2de9fb2a328e088ab82ad1e49731c971fb.zip
improve `--beautify bracketize`
reduce whitespaces from if-else statements fixes #1482 closes #1483
Diffstat (limited to 'test/input/issue-1482')
-rw-r--r--test/input/issue-1482/bracketize.js73
-rw-r--r--test/input/issue-1482/default.js17
-rw-r--r--test/input/issue-1482/input.js12
3 files changed, 102 insertions, 0 deletions
diff --git a/test/input/issue-1482/bracketize.js b/test/input/issue-1482/bracketize.js
new file mode 100644
index 00000000..2c2b103c
--- /dev/null
+++ b/test/input/issue-1482/bracketize.js
@@ -0,0 +1,73 @@
+if (x) {
+ foo();
+}
+
+if (x) {
+ foo();
+} else {
+ baz();
+}
+
+if (x) {
+ foo();
+} else if (y) {
+ bar();
+} else {
+ baz();
+}
+
+if (x) {
+ if (y) {
+ foo();
+ } else {
+ bar();
+ }
+} else {
+ baz();
+}
+
+if (x) {
+ foo();
+} else if (y) {
+ bar();
+} else if (z) {
+ baz();
+} else {
+ moo();
+}
+
+function f() {
+ if (x) {
+ foo();
+ }
+ if (x) {
+ foo();
+ } else {
+ baz();
+ }
+ if (x) {
+ foo();
+ } else if (y) {
+ bar();
+ } else {
+ baz();
+ }
+ if (x) {
+ if (y) {
+ foo();
+ } else {
+ bar();
+ }
+ } else {
+ baz();
+ }
+ if (x) {
+ foo();
+ } else if (y) {
+ bar();
+ } else if (z) {
+ baz();
+ } else {
+ moo();
+ }
+}
diff --git a/test/input/issue-1482/default.js b/test/input/issue-1482/default.js
new file mode 100644
index 00000000..14054e98
--- /dev/null
+++ b/test/input/issue-1482/default.js
@@ -0,0 +1,17 @@
+if (x) foo();
+
+if (x) foo(); else baz();
+
+if (x) foo(); else if (y) bar(); else baz();
+
+if (x) if (y) foo(); else bar(); else baz();
+
+if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
+
+function f() {
+ if (x) foo();
+ if (x) foo(); else baz();
+ if (x) foo(); else if (y) bar(); else baz();
+ if (x) if (y) foo(); else bar(); else baz();
+ if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
+}
diff --git a/test/input/issue-1482/input.js b/test/input/issue-1482/input.js
new file mode 100644
index 00000000..0186e82c
--- /dev/null
+++ b/test/input/issue-1482/input.js
@@ -0,0 +1,12 @@
+if (x) foo();
+if (x) foo(); else baz();
+if (x) foo(); else if (y) bar(); else baz();
+if (x) if (y) foo(); else bar(); else baz();
+if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
+function f() {
+if (x) foo();
+if (x) foo(); else baz();
+if (x) foo(); else if (y) bar(); else baz();
+if (x) if (y) foo(); else bar(); else baz();
+if (x) foo(); else if (y) bar(); else if (z) baz(); else moo();
+}