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: extend test for blank lin...
details: https://anonhg.NetBSD.org/src/rev/238bfa8f4bb6
branches: trunk
changeset: 374826:238bfa8f4bb6
user: rillig <rillig%NetBSD.org@localhost>
date: Sat May 13 14:19:14 2023 +0000
description:
tests/indent: extend test for blank line after declaration
diffstat:
tests/usr.bin/indent/opt_bad.c | 68 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 67 insertions(+), 1 deletions(-)
diffs (79 lines):
diff -r 9a058d1b347e -r 238bfa8f4bb6 tests/usr.bin/indent/opt_bad.c
--- a/tests/usr.bin/indent/opt_bad.c Sat May 13 13:48:54 2023 +0000
+++ b/tests/usr.bin/indent/opt_bad.c Sat May 13 14:19:14 2023 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index