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: add another test case for...



details:   https://anonhg.NetBSD.org/src/rev/fdfa0be0761a
branches:  trunk
changeset: 1019522:fdfa0be0761a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 13 13:04:13 2021 +0000

description:
tests/indent: add another test case for preprocessing directives

In process_preprocessing, the variable 'quote' is not used, which makes
the code suspicious of not handling the combination of string literals
and comments properly.

diffstat:

 tests/usr.bin/indent/token-preprocessing.0        |  10 +++++++++-
 tests/usr.bin/indent/token-preprocessing.0.stdout |  12 +++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r 234b496af039 -r fdfa0be0761a tests/usr.bin/indent/token-preprocessing.0
--- a/tests/usr.bin/indent/token-preprocessing.0        Sat Mar 13 12:52:24 2021 +0000
+++ b/tests/usr.bin/indent/token-preprocessing.0        Sat Mar 13 13:04:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-preprocessing.0,v 1.2 2021/03/12 22:53:18 rillig Exp $ */
+/* $NetBSD: token-preprocessing.0,v 1.3 2021/03/13 13:04:13 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -26,3 +26,11 @@
 #  else /* inner else comment */
 #  endif /* inner endif comment */
 #endif /* outer endif comment */
+
+#define multi_line_definition /* first line
+ * middle
+ * final line
+ */ actual_value
+
+#define comment_in_string_literal "/* no comment "
+int this_is_an_ordinary_line_again;
diff -r 234b496af039 -r fdfa0be0761a tests/usr.bin/indent/token-preprocessing.0.stdout
--- a/tests/usr.bin/indent/token-preprocessing.0.stdout Sat Mar 13 12:52:24 2021 +0000
+++ b/tests/usr.bin/indent/token-preprocessing.0.stdout Sat Mar 13 13:04:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-preprocessing.0.stdout,v 1.2 2021/03/12 22:53:18 rillig Exp $ */
+/* $NetBSD: token-preprocessing.0.stdout,v 1.3 2021/03/13 13:04:13 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -27,3 +27,13 @@
 #else                          /* inner else comment */
 #endif                         /* inner endif comment */
 #endif                         /* outer endif comment */
+
+#define multi_line_definition /* first line
+ * middle
+ * final line
+ */ actual_value
+
+#define comment_in_string_literal "/* no comment "
+int this_is_an_ordinary_line_again;
+
+/* $ FIXME: The above empty line is wrong. */



Home | Main Index | Thread Index | Old Index