Module Name: src
Committed By: rillig
Date: Sat May 13 14:19:14 UTC 2023
Modified Files:
src/tests/usr.bin/indent: opt_bad.c
Log Message:
tests/indent: extend test for blank line after declaration
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/opt_bad.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/opt_bad.c
diff -u src/tests/usr.bin/indent/opt_bad.c:1.7 src/tests/usr.bin/indent/opt_bad.c:1.8
--- src/tests/usr.bin/indent/opt_bad.c:1.7 Thu May 11 18:13:55 2023
+++ src/tests/usr.bin/indent/opt_bad.c Sat May 13 14:19:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bad.c,v 1.7 2023/05/11 18:13:55 rillig Exp $ */
+/* $NetBSD: opt_bad.c,v 1.8 2023/05/13 14:19:14 rillig Exp $ */
/*
* Tests for the options '-bad' and '-nbad'.
@@ -87,3 +87,69 @@ function_definition(void)
function_call();
}
//indent end
+
+
+/*
+ * A comment after a declaration does not change whether there should be a
+ * blank line below the declaration.
+ */
+//indent input
+void
+comments(void)
+{
+ int local_var_1; /* comment */
+ int local_var_2; /* comment */
+ /* comment line */
+ function_call();
+}
+//indent end
+
+//indent run -ldi0 -bad
+void
+comments(void)
+{
+ int local_var_1; /* comment */
+ int local_var_2; /* comment */
+ /* comment line */
+ /* $ TODO: Add blank line here. */
+ function_call();
+}
+//indent end
+
+//indent run-equals-input -ldi0 -nbad
+
+
+/*
+ * A declaration that has a braced initializer is still a declaration and
+ * therefore needs a blank line below.
+ */
+//indent input
+void
+initializer(void)
+{
+ int local_var_init_1[] = {
+ 1
+ };
+ int local_var_init_2[] = {
+ 1
+ };
+ function_call();
+}
+//indent end
+
+//indent run -ldi0 -bad
+void
+initializer(void)
+{
+ int local_var_init_1[] = {
+ 1
+ };
+ int local_var_init_2[] = {
+ 1
+ };
+ /* $ TODO: Add blank line here. */
+ function_call();
+}
+//indent end
+
+//indent run-equals-input -ldi0 -nbad