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/5007ce1a4312
branches:  trunk
changeset: 960040:5007ce1a4312
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 b59b933e19a9 -r 5007ce1a4312 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 b59b933e19a9 -r 5007ce1a4312 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