Module Name:    src
Committed By:   rillig
Date:           Sat Oct 16 09:39:21 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: opt_bad.c opt_badp.c

Log Message:
tests/indent: clean up tests for '-bad' and '-badp'


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/opt_bad.c \
    src/tests/usr.bin/indent/opt_badp.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.1 src/tests/usr.bin/indent/opt_bad.c:1.2
--- src/tests/usr.bin/indent/opt_bad.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_bad.c	Sat Oct 16 09:39:21 2021
@@ -1,34 +1,52 @@
-/* $NetBSD: opt_bad.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_bad.c,v 1.2 2021/10/16 09:39:21 rillig Exp $ */
 /* $FreeBSD$ */
 
-#indent input
 /*
- * The option -bad only affects declarations of local variables.  It does not
- * affect file-scoped declarations or definitions.
+ * Tests for the options '-bad' and '-nbad'.
+ *
+ * The option '-bad' forces a blank line after every block of declarations.
+ * It only affects declarations of local variables.  It does not affect
+ * file-scoped declarations or definitions.
+ *
+ * The option '-nbad' leaves everything as is.
  */
 
+/* Test global declarations. */
+#indent input
 int global_variable;
 void function_declaration(void);
 #if 0
 #endif
-void function_definition(void) {
-	int local_variable;
-	function_call();
-	int local_variable_after_statement;
-	function_call();
-}
+/* comment */
 #indent end
 
 #indent run -bad
-/*
- * The option -bad only affects declarations of local variables.  It does not
- * affect file-scoped declarations or definitions.
- */
+int		global_variable;
+void		function_declaration(void);
+#if 0
+#endif
+/* comment */
+#indent end
 
+#indent run -nbad
 int		global_variable;
 void		function_declaration(void);
 #if 0
 #endif
+/* comment */
+#indent end
+
+/* Test local declarations. */
+#indent input
+void function_definition(void) {
+    int local_variable;
+    function_call();
+    int local_variable_after_statement;
+    function_call();
+}
+#indent end
+
+#indent run -bad
 void
 function_definition(void)
 {
@@ -41,30 +59,15 @@ function_definition(void)
 }
 #indent end
 
-#indent input
-int global_variable;
-void function_declaration(void);
-#if 0
-#endif
-void function_definition(void) {
-	int local_variable;
-	function_call();
-	int local_variable_after_statement;
-	function_call();
-}
-#indent end
-
 #indent run -nbad
-int		global_variable;
-void		function_declaration(void);
-#if 0
-#endif
 void
 function_definition(void)
 {
 	int		local_variable;
+	/* $ No blank line here. */
 	function_call();
 	int		local_variable_after_statement;
+	/* $ No blank line here. */
 	function_call();
 }
 #indent end
Index: src/tests/usr.bin/indent/opt_badp.c
diff -u src/tests/usr.bin/indent/opt_badp.c:1.1 src/tests/usr.bin/indent/opt_badp.c:1.2
--- src/tests/usr.bin/indent/opt_badp.c:1.1	Sat Oct 16 03:20:13 2021
+++ src/tests/usr.bin/indent/opt_badp.c	Sat Oct 16 09:39:21 2021
@@ -1,6 +1,13 @@
-/* $NetBSD: opt_badp.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
+/* $NetBSD: opt_badp.c,v 1.2 2021/10/16 09:39:21 rillig Exp $ */
 /* $FreeBSD$ */
 
+/*
+ * Tests for the options '-badp' and '-nbadp'.
+ *
+ * The option '-badp' forces a blank line after the first set of declarations
+ * in a function. It produces a blank line even if there are no declarations.
+ */
+
 #indent input
 static void
 no_declarations(void)
@@ -12,7 +19,7 @@ static void
 declarations_without_blank_line(void)
 {
 	int local_variable;
-	action();		/* FIXME: need empty line above */
+	action();
 }
 
 static void
@@ -46,7 +53,8 @@ static void
 declarations_without_blank_line(void)
 {
 	int		local_variable;
-	action();		/* FIXME: need empty line above */
+	/* $ FIXME: need empty line here */
+	action();
 }
 
 static void
@@ -68,39 +76,6 @@ declaration_with_several_blank_lines(voi
 }
 #indent end
 
-#indent input
-static void
-no_declarations(void)
-{
-	action();
-}
-
-static void
-declarations_without_blank_line(void)
-{
-	int local_variable;
-	action();
-}
-
-static void
-declaration_with_blank_line(void)
-{
-	int local_variable;
-
-	action();
-}
-
-static void
-declaration_with_several_blank_lines(void)
-{
-	int local_variable;
-
-
-
-	action();
-}
-#indent end
-
 #indent run -nbadp
 static void
 no_declarations(void)

Reply via email to