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 '//' comm...



details:   https://anonhg.NetBSD.org/src/rev/7f9950511c4c
branches:  trunk
changeset: 981264:7f9950511c4c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 06 15:02:38 2021 +0000

description:
tests/indent: extend test for '//' comments with more examples

diffstat:

 tests/usr.bin/indent/comment-line-end.0        |  19 +++++++++++++++++--
 tests/usr.bin/indent/comment-line-end.0.stdout |  25 ++++++++++++++++++++++---
 2 files changed, 39 insertions(+), 5 deletions(-)

diffs (73 lines):

diff -r f4fff4352668 -r 7f9950511c4c tests/usr.bin/indent/comment-line-end.0
--- a/tests/usr.bin/indent/comment-line-end.0   Sat Mar 06 14:44:02 2021 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0   Sat Mar 06 15:02:38 2021 +0000
@@ -1,9 +1,24 @@
-/* $NetBSD: comment-line-end.0,v 1.1 2021/02/21 21:26:26 rillig Exp $ */
+/* $NetBSD: comment-line-end.0,v 1.2 2021/03/06 15:02:38 rillig Exp $ */
 /* This $FreeBSD$ tag is required by the test suite, for no reason. */
 
 /*
- * Demonstrates that line-end comments can affect the following lines.
+ * Demonstrates handling of line-end comments.
  *
+ * Even though this type of comments was added in C99, indent doesn't support
+ * them, as of 2021, and instead messes up the code in unpredictable ways.
+ */
+
+int dummy // comment
+= // eq
+1 // one
++ // plus
+2; // two
+
+/////separator/////
+
+void function(void){}
+
+/*
  * FIXME: The '{' of main must be in column 1, not directly after the ')'.
  *
  * FIXME: The 'Note: removing' below gets "indented" to 'Note:removing'.
diff -r f4fff4352668 -r 7f9950511c4c tests/usr.bin/indent/comment-line-end.0.stdout
--- a/tests/usr.bin/indent/comment-line-end.0.stdout    Sat Mar 06 14:44:02 2021 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0.stdout    Sat Mar 06 15:02:38 2021 +0000
@@ -1,9 +1,28 @@
-/* $NetBSD: comment-line-end.0.stdout,v 1.1 2021/02/21 21:26:26 rillig Exp $ */
+/* $NetBSD: comment-line-end.0.stdout,v 1.2 2021/03/06 15:02:38 rillig Exp $ */
 /* This $FreeBSD$ tag is required by the test suite, for no reason. */
 
 /*
- * Demonstrates that line-end comments can affect the following lines.
+ * Demonstrates handling of line-end comments.
  *
+ * Even though this type of comments was added in C99, indent doesn't support
+ * them, as of 2021, and instead messes up the code in unpredictable ways.
+ */
+
+int            dummy //comment
+= //eq
+1 // one
++ //plus
+2;
+//two
+
+///// separator /////
+
+void
+function(void)
+{
+}
+
+/*
  * FIXME: The '{' of main must be in column 1, not directly after the ')'.
  *
  * FIXME: The 'Note: removing' below gets "indented" to 'Note:removing'.
@@ -11,7 +30,7 @@
  * FIXME: The 'line-end' gets "indented" to 'line - end'.
  */
 
-// Note:removing one of these line - end comments affects the formatting
+//Note:removing one of these line - end comments affects the formatting
 // of the main function below.
 
 int



Home | Main Index | Thread Index | Old Index