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: add tests for 'do-while' ...



details:   https://anonhg.NetBSD.org/src/rev/6260c81a981b
branches:  trunk
changeset: 376225:6260c81a981b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jun 05 08:10:25 2023 +0000

description:
tests/indent: add tests for 'do-while' loops

diffstat:

 tests/usr.bin/indent/lsym_do.c |  47 +++++++++++++++++++++++++++++++++++++++++-
 tests/usr.bin/indent/psym_do.c |   6 ++++-
 2 files changed, 51 insertions(+), 2 deletions(-)

diffs (75 lines):

diff -r 5b80cd43f2d1 -r 6260c81a981b tests/usr.bin/indent/lsym_do.c
--- a/tests/usr.bin/indent/lsym_do.c    Mon Jun 05 07:35:05 2023 +0000
+++ b/tests/usr.bin/indent/lsym_do.c    Mon Jun 05 08:10:25 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_do.c,v 1.7 2023/05/22 23:01:27 rillig Exp $ */
+/* $NetBSD: lsym_do.c,v 1.8 2023/06/05 08:10:25 rillig Exp $ */
 
 /*
  * Tests for the token lsym_do, which represents the keyword 'do' that starts
@@ -110,3 +110,48 @@ variants(void)
                } while (0);
 }
 //indent end
+
+
+/* Ensure that the 'do' starts a line. */
+//indent input
+{
+       /* */ do {} while (false);
+
+       word do {} while (false);
+
+       label: do {} while (false);
+}
+//indent end
+
+//indent run
+{
+// $ FIXME: Trailing whitespace.
+       /* */ 
+       do {
+       } while (false);
+
+       word
+       do {
+       } while         (false);
+
+label: do {
+       } while (false);
+}
+//indent end
+
+//indent run -sob
+{
+// $ FIXME: Trailing whitespace.
+       /* */ 
+       do {
+       } while (false);
+// $ FIXME: This blank line is not optional and must be preserved.
+       word
+       do {
+// $ FIXME: The expression is indented too far to the right.
+       } while         (false);
+// $ FIXME: This blank line is not optional and must be preserved.
+label: do {
+       } while (false);
+}
+//indent end
diff -r 5b80cd43f2d1 -r 6260c81a981b tests/usr.bin/indent/psym_do.c
--- a/tests/usr.bin/indent/psym_do.c    Mon Jun 05 07:35:05 2023 +0000
+++ b/tests/usr.bin/indent/psym_do.c    Mon Jun 05 08:10:25 2023 +0000
@@ -1,8 +1,12 @@
-/* $NetBSD: psym_do.c,v 1.4 2022/04/24 10:36:37 rillig Exp $ */
+/* $NetBSD: psym_do.c,v 1.5 2023/06/05 08:10:25 rillig Exp $ */
 
 /*
  * Tests for the parser symbol psym_do, which represents the state after
  * reading the token 'do', now waiting for the statement of the loop body.
+ *
+ * See also:
+ *     lsym_do.c
+ *     psym_do_stmt.c
  */
 
 //indent input



Home | Main Index | Thread Index | Old Index