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: fix comments



details:   https://anonhg.NetBSD.org/src/rev/c7a3c63bd368
branches:  trunk
changeset: 376598:c7a3c63bd368
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jun 23 20:44:51 2023 +0000

description:
tests/indent: fix comments

diffstat:

 tests/usr.bin/indent/fmt_else_comment.c |  17 ++++++++++-------
 tests/usr.bin/indent/opt_bap.c          |   4 ++--
 tests/usr.bin/indent/psym_switch_expr.c |   4 ++--
 3 files changed, 14 insertions(+), 11 deletions(-)

diffs (83 lines):

diff -r ea91eb018f5a -r c7a3c63bd368 tests/usr.bin/indent/fmt_else_comment.c
--- a/tests/usr.bin/indent/fmt_else_comment.c   Fri Jun 23 20:43:21 2023 +0000
+++ b/tests/usr.bin/indent/fmt_else_comment.c   Fri Jun 23 20:44:51 2023 +0000
@@ -1,10 +1,11 @@
-/*     $NetBSD: fmt_else_comment.c,v 1.5 2023/05/11 09:28:53 rillig Exp $      */
+/*     $NetBSD: fmt_else_comment.c,v 1.6 2023/06/23 20:44:51 rillig Exp $      */
 
 /*
- * Tests for comments after 'if (expr)' and 'else'. If the option '-br' is
- * given (or rather, if '-bl' is not given), indent looks ahead to the
- * following significant token to see whether it is a '{', it then moves the
- * comments after the '{'.
+ * Tests for comments after 'if (expr)' and 'else'. Before 2023-05-11, if the
+ * option '-br' was given (or rather, if '-bl' was not given), indent looked
+ * ahead to the following significant token to see whether it was a '{', it
+ * then moved the comments after the '{'. This token swapping was error-prone
+ * and thus removed.
  *
  * See also:
  *     FreeBSD r303484
@@ -12,8 +13,8 @@
  */
 
 /*
- * The two 'if' statements below exercise two different code paths, even
- * though they look very similar.
+ * Before 2023-05-11, the two 'if' statements below exercised two different
+ * code paths, even though they look very similar.
  */
 //indent input
 void t(void) {
@@ -52,6 +53,7 @@ void t(void) {
 
 
        /* Old indent would remove the 3 blank lines above, awaiting "else". */
+       // $ 'Old' means something before 2019.
 
        if (1) {
                int a;
@@ -68,6 +70,7 @@ void t(void) {
        if (1)
                ;
        else /* Old indent would get very confused here */
+       // $ 'Old' means something before 2019.
        /* We also mustn't assume that there's only one comment */
        /* before the left brace. */
        {
diff -r ea91eb018f5a -r c7a3c63bd368 tests/usr.bin/indent/opt_bap.c
--- a/tests/usr.bin/indent/opt_bap.c    Fri Jun 23 20:43:21 2023 +0000
+++ b/tests/usr.bin/indent/opt_bap.c    Fri Jun 23 20:44:51 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bap.c,v 1.10 2023/06/16 11:48:32 rillig Exp $ */
+/* $NetBSD: opt_bap.c,v 1.11 2023/06/23 20:44:51 rillig Exp $ */
 
 /*
  * Tests for the options '-bap' and '-nbap' ("blank line after procedure
@@ -115,7 +115,7 @@ example(void)
 
 /*
  * A preprocessing line after the end of a function body does not force a blank
- * line, as these lines are not a different syntactic layer.
+ * line, as these lines are from a different syntactic layer.
  */
 //indent input
 #if 0
diff -r ea91eb018f5a -r c7a3c63bd368 tests/usr.bin/indent/psym_switch_expr.c
--- a/tests/usr.bin/indent/psym_switch_expr.c   Fri Jun 23 20:43:21 2023 +0000
+++ b/tests/usr.bin/indent/psym_switch_expr.c   Fri Jun 23 20:44:51 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psym_switch_expr.c,v 1.5 2023/06/06 04:37:27 rillig Exp $ */
+/* $NetBSD: psym_switch_expr.c,v 1.6 2023/06/23 20:44:51 rillig Exp $ */
 
 /*
  * Tests for the parser symbol psym_switch_expr, which represents the keyword
@@ -12,7 +12,7 @@
 /*
  * In all practical cases, a 'switch (expr)' is followed by a block, but the
  * C syntax allows an arbitrary statement.  Unless such a statement has a
- * label, it is unreachable.
+ * label or is a loop, its beginning is unreachable.
  */
 //indent input
 void



Home | Main Index | Thread Index | Old Index