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: demonstrate wrong spacing...



details:   https://anonhg.NetBSD.org/src/rev/56b4b51bb345
branches:  trunk
changeset: 375331:56b4b51bb345
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon May 15 08:22:23 2023 +0000

description:
tests/indent: demonstrate wrong spacing in for loops

diffstat:

 tests/usr.bin/indent/psym_for_exprs.c |  29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 83632d8bad29 -r 56b4b51bb345 tests/usr.bin/indent/psym_for_exprs.c
--- a/tests/usr.bin/indent/psym_for_exprs.c     Mon May 15 08:11:27 2023 +0000
+++ b/tests/usr.bin/indent/psym_for_exprs.c     Mon May 15 08:22:23 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psym_for_exprs.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: psym_for_exprs.c,v 1.5 2023/05/15 08:22:23 rillig Exp $ */
 
 /*
  * Tests for the parser state psym_for_exprs, which represents the state after
@@ -7,10 +7,31 @@
  */
 
 //indent input
-// TODO: add input
+void
+for_loops(void)
+{
+       for (int i = 0; i < 10; i++)
+               printf("%d * %d = %d\n", i, 7, i * 7);
+
+       for (int i = 0; i < 10; i++) {
+               printf("%d * %d = %d\n", i, 7, i * 7);
+       }
+}
 //indent end
 
-//indent run-equals-input
+//indent run
+void
+for_loops(void)
+{
+       for (int i = 0; i < 10; i++)
+               printf("%d * %d = %d\n", i, 7, i * 7);
+
+       /* $ FIXME: Add space between ')' and '{'. */
+       for (int i = 0; i < 10; i++){
+               printf("%d * %d = %d\n", i, 7, i * 7);
+       }
+}
+//indent end
 
 
 /*
@@ -19,7 +40,7 @@
  */
 //indent input
 void
-function(void)
+small_scope(void)
 {
        for (int i = 0; i < 3; i++)
                stmt();



Home | Main Index | Thread Index | Old Index