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 move coverage tests



details:   https://anonhg.NetBSD.org/src/rev/98b2f24c2039
branches:  trunk
changeset: 376334:98b2f24c2039
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jun 10 17:56:29 2023 +0000

description:
tests/indent: add move coverage tests

diffstat:

 tests/usr.bin/indent/fmt_decl.c     |  18 +++++++++++++++++-
 tests/usr.bin/indent/psym_if_expr.c |  26 +++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 2 deletions(-)

diffs (66 lines):

diff -r f4a3b8ac953b -r 98b2f24c2039 tests/usr.bin/indent/fmt_decl.c
--- a/tests/usr.bin/indent/fmt_decl.c   Sat Jun 10 17:35:40 2023 +0000
+++ b/tests/usr.bin/indent/fmt_decl.c   Sat Jun 10 17:56:29 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fmt_decl.c,v 1.53 2023/06/10 06:38:21 rillig Exp $     */
+/*     $NetBSD: fmt_decl.c,v 1.54 2023/06/10 17:56:29 rillig Exp $     */
 
 /*
  * Tests for declarations of global variables, external functions, and local
@@ -1069,3 +1069,19 @@ b[] = {1, 2};
        b[] = {1, 2};
 }
 //indent end
+
+
+/*
+ * When a type occurs at the top level, it forces a line break before.
+ */
+//indent input
+__attribute__((__dead__)) void die(void) {}
+//indent end
+
+//indent run
+__attribute__((__dead__))
+void
+die(void)
+{
+}
+//indent end
diff -r f4a3b8ac953b -r 98b2f24c2039 tests/usr.bin/indent/psym_if_expr.c
--- a/tests/usr.bin/indent/psym_if_expr.c       Sat Jun 10 17:35:40 2023 +0000
+++ b/tests/usr.bin/indent/psym_if_expr.c       Sat Jun 10 17:56:29 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psym_if_expr.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: psym_if_expr.c,v 1.5 2023/06/10 17:56:29 rillig Exp $ */
 
 /*
  * Tests for the parser symbol psym_if_expr, representing the parser state
@@ -20,3 +20,27 @@ function(void)
                stmt();
 }
 //indent end
+
+
+/*
+ * Indent is forgiving about syntax errors such as an 'if' statement in which
+ * the condition is not parenthesized.
+ */
+//indent input
+{
+       if cond {
+       }
+       if cond && cond {
+       }
+}
+//indent end
+
+//indent run
+{
+       if cond {
+       }
+       if cond
+               && cond {
+               }
+}
+//indent end



Home | Main Index | Thread Index | Old Index