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 indent: add test demonstrating that ind...



details:   https://anonhg.NetBSD.org/src/rev/8c8b1de3f0a5
branches:  trunk
changeset: 959688:8c8b1de3f0a5
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 21 21:26:26 2021 +0000

description:
indent: add test demonstrating that indent cannot handle C99

indent cannot handle line-end comments.

The indent test suite requires each test file to have both a NetBSD and
a FreeBSD RCS ID.  If the FreeBSD RCS ID is missing, the test will
silently pass since in that case, an empty file is compared with an
empty file.  See the /start/,/end/ operator in t_indent.sh.

diffstat:

 distrib/sets/lists/tests/mi                    |   4 +++-
 tests/usr.bin/indent/Makefile                  |   4 +++-
 tests/usr.bin/indent/comment-line-end.0        |  20 ++++++++++++++++++++
 tests/usr.bin/indent/comment-line-end.0.stdout |  19 +++++++++++++++++++
 4 files changed, 45 insertions(+), 2 deletions(-)

diffs (83 lines):

diff -r d36c6bb53d56 -r 8c8b1de3f0a5 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Feb 21 20:33:42 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Feb 21 21:26:26 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1021 2021/02/21 08:05:51 rillig Exp $
+# $NetBSD: mi,v 1.1022 2021/02/21 21:26:26 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4708,6 +4708,8 @@
 ./usr/tests/usr.bin/indent/Kyuafile                    tests-usr.bin-tests     compattestfile,atf,kyua
 ./usr/tests/usr.bin/indent/binary.0                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/binary.0.stdout             tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/indent/comment-line-end.0          tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/indent/comment-line-end.0.stdout   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/comments.0                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/comments.0.pro              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/indent/comments.0.stdout           tests-usr.bin-tests     compattestfile,atf
diff -r d36c6bb53d56 -r 8c8b1de3f0a5 tests/usr.bin/indent/Makefile
--- a/tests/usr.bin/indent/Makefile     Sun Feb 21 20:33:42 2021 +0000
+++ b/tests/usr.bin/indent/Makefile     Sun Feb 21 21:26:26 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1 2019/04/04 15:27:35 kamil Exp $
+#      $NetBSD: Makefile,v 1.2 2021/02/21 21:26:26 rillig Exp $
 
 .include <bsd.own.mk>
 
@@ -8,6 +8,8 @@
 FILESDIR=      ${TESTSDIR}
 FILES=         binary.0
 FILES+=                binary.0.stdout
+FILES+=                comment-line-end.0
+FILES+=                comment-line-end.0.stdout
 FILES+=                comments.0
 FILES+=                comments.0.pro
 FILES+=                comments.0.stdout
diff -r d36c6bb53d56 -r 8c8b1de3f0a5 tests/usr.bin/indent/comment-line-end.0
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0   Sun Feb 21 21:26:26 2021 +0000
@@ -0,0 +1,20 @@
+/* $NetBSD: comment-line-end.0,v 1.1 2021/02/21 21:26:26 rillig Exp $ */
+/* This $FreeBSD$ tag is required by the test suite, for no reason. */
+
+/*
+ * Demonstrates that line-end comments can affect the following lines.
+ *
+ * FIXME: The '{' of main must be in column 1, not directly after the ')'.
+ *
+ * FIXME: The 'Note: removing' below gets "indented" to 'Note:removing'.
+ *
+ * FIXME: The 'line-end' gets "indented" to 'line - end'.
+ */
+
+// Note: removing one of these line-end comments affects the formatting
+// of the main function below.
+
+int
+main(void)
+{
+}
diff -r d36c6bb53d56 -r 8c8b1de3f0a5 tests/usr.bin/indent/comment-line-end.0.stdout
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0.stdout    Sun Feb 21 21:26:26 2021 +0000
@@ -0,0 +1,19 @@
+/* $NetBSD: comment-line-end.0.stdout,v 1.1 2021/02/21 21:26:26 rillig Exp $ */
+/* This $FreeBSD$ tag is required by the test suite, for no reason. */
+
+/*
+ * Demonstrates that line-end comments can affect the following lines.
+ *
+ * FIXME: The '{' of main must be in column 1, not directly after the ')'.
+ *
+ * FIXME: The 'Note: removing' below gets "indented" to 'Note:removing'.
+ *
+ * FIXME: The 'line-end' gets "indented" to 'line - end'.
+ */
+
+// Note:removing one of these line - end comments affects the formatting
+// of the main function below.
+
+int
+main(void){
+}



Home | Main Index | Thread Index | Old Index