Module Name: src
Committed By: rillig
Date: Sat Jun 10 17:56:29 UTC 2023
Modified Files:
src/tests/usr.bin/indent: fmt_decl.c psym_if_expr.c
Log Message:
tests/indent: add move coverage tests
To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/psym_if_expr.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/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.53 src/tests/usr.bin/indent/fmt_decl.c:1.54
--- src/tests/usr.bin/indent/fmt_decl.c:1.53 Sat Jun 10 06:38:21 2023
+++ src/tests/usr.bin/indent/fmt_decl.c Sat Jun 10 17:56:29 2023
@@ -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
Index: src/tests/usr.bin/indent/psym_if_expr.c
diff -u src/tests/usr.bin/indent/psym_if_expr.c:1.4 src/tests/usr.bin/indent/psym_if_expr.c:1.5
--- src/tests/usr.bin/indent/psym_if_expr.c:1.4 Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/psym_if_expr.c Sat Jun 10 17:56:29 2023
@@ -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