Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/indent tests/indent: extend test for wrong ind...



details:   https://anonhg.NetBSD.org/src/rev/97555eaea49d
branches:  trunk
changeset: 376269:97555eaea49d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jun 08 20:28:50 2023 +0000

description:
tests/indent: extend test for wrong indentation in 'else if'

diffstat:

 tests/usr.bin/indent/opt_lp.c |  49 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 40 insertions(+), 9 deletions(-)

diffs (70 lines):

diff -r 97f8780bfebd -r 97555eaea49d tests/usr.bin/indent/opt_lp.c
--- a/tests/usr.bin/indent/opt_lp.c     Thu Jun 08 06:47:13 2023 +0000
+++ b/tests/usr.bin/indent/opt_lp.c     Thu Jun 08 20:28:50 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_lp.c,v 1.7 2023/05/23 06:18:00 rillig Exp $ */
+/* $NetBSD: opt_lp.c,v 1.8 2023/06/08 20:28:50 rillig Exp $ */
 
 /*
  * Tests for the options '-lp' and '-nlp'.
@@ -91,21 +91,52 @@ example(void)
 
 //indent input
 {
-if (cond) {
-} else if (cond &&
-cond &&
-cond) {
+if (cond11a
+&& cond11b
+&& cond11c) {
+stmt11;
+} else if (cond12a
+&& cond12b
+&& cond12c) {
+stmt12;
+}
 }
+
+{
+if (cond21a
+&& cond21b
+&& cond21c)
+stmt21;
+else if (cond22a
+&& cond22b
+&& cond22c)
+stmt22;
 }
 //indent end
 
 //indent run -ci4 -nlp
 {
-       if (cond) {
-       } else if (cond &&
+       if (cond11a
+           && cond11b
+           && cond11c) {
+               stmt11;
+       } else if (cond12a
 // $ FIXME: Wrong indentation, should be 4 spaces only.
-                   cond &&
-           cond) {
+                   && cond12b
+           && cond12c) {
+               stmt12;
        }
 }
+
+{
+       if (cond21a
+           && cond21b
+           && cond21c)
+               stmt21;
+       else if (cond22a
+// $ FIXME: Wrong indentation, should be 4 spaces only.
+                   && cond22b
+           && cond22c)
+               stmt22;
+}
 //indent end



Home | Main Index | Thread Index | Old Index