Module Name:    src
Committed By:   rillig
Date:           Mon Jun  5 08:10:25 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_do.c psym_do.c

Log Message:
tests/indent: add tests for 'do-while' loops


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/lsym_do.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/psym_do.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/indent/lsym_do.c
diff -u src/tests/usr.bin/indent/lsym_do.c:1.7 src/tests/usr.bin/indent/lsym_do.c:1.8
--- src/tests/usr.bin/indent/lsym_do.c:1.7	Mon May 22 23:01:27 2023
+++ src/tests/usr.bin/indent/lsym_do.c	Mon Jun  5 08:10:25 2023
@@ -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

Index: src/tests/usr.bin/indent/psym_do.c
diff -u src/tests/usr.bin/indent/psym_do.c:1.4 src/tests/usr.bin/indent/psym_do.c:1.5
--- src/tests/usr.bin/indent/psym_do.c:1.4	Sun Apr 24 10:36:37 2022
+++ src/tests/usr.bin/indent/psym_do.c	Mon Jun  5 08:10:25 2023
@@ -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

Reply via email to