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: clean up test for the opt...
details: https://anonhg.NetBSD.org/src/rev/a4471975c6dd
branches: trunk
changeset: 1026362:a4471975c6dd
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 20 10:24:30 2021 +0000
description:
tests/indent: clean up test for the options '-cdb' and '-ncdb'
diffstat:
tests/usr.bin/indent/opt_cdb.c | 136 ++++++++++++++++++++++--------------
tests/usr.bin/indent/t_options.awk | 4 +-
2 files changed, 87 insertions(+), 53 deletions(-)
diffs (253 lines):
diff -r 9e381fde95db -r a4471975c6dd tests/usr.bin/indent/opt_cdb.c
--- a/tests/usr.bin/indent/opt_cdb.c Sat Nov 20 09:59:53 2021 +0000
+++ b/tests/usr.bin/indent/opt_cdb.c Sat Nov 20 10:24:30 2021 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: opt_cdb.c,v 1.5 2021/11/07 13:30:15 rillig Exp $ */
+/* $NetBSD: opt_cdb.c,v 1.6 2021/11/20 10:24:30 rillig Exp $ */
/* $FreeBSD$ */
/*
* Tests for the options '-cdb' and '-ncdb'.
*
* The option '-cdb' forces the comment delimiter '/' '*' and '*' '/' to be on
- * a separate line. This only affects block comments, not comments to the
+ * a separate line. This only affects block comments, but not comments to the
* right of the code.
*
* The option '-ncdb' compresses multi-line comments to single-line comments,
@@ -13,37 +13,47 @@
*/
#indent input
-/* A single-line comment. */
+/* A single line without delimiters. */
-/* A
- * multi-line
- * comment. */
+/* Multiple
+ * lines
+ * without delimiters. */
/*
- * A
- * multi-line
- * comment.
+ * A single line with delimiters.
+ */
+
+/*
+ * Multiple
+ * lines
+ * with delimiters.
*/
#indent end
#indent run -cdb
-/* A single-line comment. */
+/* A single line without delimiters. */
/*
- * A multi-line comment.
+ * Multiple lines without delimiters.
*/
/*
- * A multi-line comment.
+ * A single line with delimiters.
+ */
+
+/*
+ * Multiple lines with delimiters.
*/
#indent end
#indent run -ncdb
-/* A single-line comment. */
+/* A single line without delimiters. */
+
+/* Multiple lines without delimiters. */
-/* A multi-line comment. */
+/* A single line with delimiters. */
-/* A multi-line comment. */
+/* Multiple lines with delimiters. */
#indent end
@@ -51,28 +61,35 @@
* Code comments on global declarations.
*/
#indent input
-int ga; /* A single-line comment. */
+int global_single_without; /* A single line without delimiters. */
+
+int global_multi_without; /*
+ * Multiple lines without delimiters.
+ */
-int gb; /* A
- * multi-line
- * comment. */
+int global_single_with; /*
+ * A single line with delimiters.
+ */
-int gc; /*
- * A
- * multi-line
- * comment.
+int global_single_with; /*
+ * Multiple
+ * lines
+ * with delimiters.
*/
#indent end
-#indent run -cdb
-int ga; /* A single-line comment. */
+#indent run -di0 -cdb
+int global_single_without; /* A single line without delimiters. */
-int gb; /* A multi-line comment. */
+int global_multi_without; /* Multiple lines without delimiters. */
-int gc; /* A multi-line comment. */
+int global_single_with; /* A single line with delimiters. */
+
+int global_single_with; /* Multiple lines with delimiters. */
#indent end
-#indent run-equals-prev-output -ncdb
+#indent run-equals-prev-output -di0 -ncdb
+
/*
* Block comments that are inside a function.
@@ -81,54 +98,67 @@
void
example(void)
{
- /* A single-line comment. */
- int la;
+ /* A single line without delimiters. */
+ int local_single_without;
- /* A
- * multi-line
- * comment. */
- int lb;
+ /* Multiple
+ * lines
+ * without delimiters. */
+ int local_multi_without;
/*
- * A
- * multi-line
- * comment.
+ * A single line with delimiters.
*/
- int lc;
+ int local_single_with;
+
+ /*
+ * Multiple
+ * lines
+ * with delimiters.
+ */
+ int local_multi_with;
}
#indent end
-#indent run -cdb
+#indent run -di0 -cdb
void
example(void)
{
- /* A single-line comment. */
- int la;
+ /* A single line without delimiters. */
+ int local_single_without;
+
+ /*
+ * Multiple lines without delimiters.
+ */
+ int local_multi_without;
/*
- * A multi-line comment.
+ * A single line with delimiters.
*/
- int lb;
+ int local_single_with;
/*
- * A multi-line comment.
+ * Multiple lines with delimiters.
*/
- int lc;
+ int local_multi_with;
}
#indent end
-#indent run -ncdb
+#indent run -di0 -ncdb
void
example(void)
{
- /* A single-line comment. */
- int la;
+ /* A single line without delimiters. */
+ int local_single_without;
+
+ /* Multiple lines without delimiters. */
+ int local_multi_without;
- /* A multi-line comment. */
- int lb;
+ /* A single line with delimiters. */
+ int local_single_with;
- /* A multi-line comment. */
- int lc;
+ /* Multiple lines with delimiters. */
+ int local_multi_with;
}
#indent end
@@ -145,6 +175,7 @@
*/
#indent end
+/* FIXME: Looks bad. */
#indent run -ncdb
/*
* */
@@ -163,6 +194,7 @@
*/
#indent end
+/* FIXME: Looks bad. */
#indent run -ncdb
/*
* */
diff -r 9e381fde95db -r a4471975c6dd tests/usr.bin/indent/t_options.awk
--- a/tests/usr.bin/indent/t_options.awk Sat Nov 20 09:59:53 2021 +0000
+++ b/tests/usr.bin/indent/t_options.awk Sat Nov 20 10:24:30 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_options.awk,v 1.3 2021/11/18 17:11:13 rillig Exp $
+# $NetBSD: t_options.awk,v 1.4 2021/11/20 10:24:30 rillig Exp $
#
# Copyright (c) 2021 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -50,6 +50,8 @@
# The actual output from running indent is written to stdout, the expected
# test output is written to 'expected.out'.
+# TODO: Require 2 empty lines before '#indent input', 1 empty line otherwise.
+
BEGIN {
warned = 0
died = 0
Home |
Main Index |
Thread Index |
Old Index