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: demonstrate mergin of com...



details:   https://anonhg.NetBSD.org/src/rev/505b7248bbd1
branches:  trunk
changeset: 987392:505b7248bbd1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 25 18:02:48 2021 +0000

description:
tests/indent: demonstrate mergin of comments

This may or may not have been intended. Especially with the option
'-nfc1' the result looks confusing. It's not a case that occurs every
day, though.

diffstat:

 tests/usr.bin/indent/opt-fc1.0         |   9 ++++++++-
 tests/usr.bin/indent/opt-fc1.0.stdout  |   9 ++++++++-
 tests/usr.bin/indent/opt-nfc1.0        |   9 ++++++++-
 tests/usr.bin/indent/opt-nfc1.0.stdout |  31 ++++++++++++++++++++++++-------
 4 files changed, 48 insertions(+), 10 deletions(-)

diffs (110 lines):

diff -r a46923d5c2f1 -r 505b7248bbd1 tests/usr.bin/indent/opt-fc1.0
--- a/tests/usr.bin/indent/opt-fc1.0    Sat Sep 25 17:55:37 2021 +0000
+++ b/tests/usr.bin/indent/opt-fc1.0    Sat Sep 25 18:02:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt-fc1.0,v 1.3 2021/09/24 17:37:55 rillig Exp $ */
+/* $NetBSD: opt-fc1.0,v 1.4 2021/09/25 18:02:48 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -23,3 +23,10 @@
 
 /* $ Both comment texts get surrounded by spaces. */
 /*block1*//*block2*/
+
+/*
+ * A multi-line comment that starts
+ * in column 1.
+ *//* followed by another multi-line comment
+ * that starts in column 4.
+ */
diff -r a46923d5c2f1 -r 505b7248bbd1 tests/usr.bin/indent/opt-fc1.0.stdout
--- a/tests/usr.bin/indent/opt-fc1.0.stdout     Sat Sep 25 17:55:37 2021 +0000
+++ b/tests/usr.bin/indent/opt-fc1.0.stdout     Sat Sep 25 18:02:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt-fc1.0.stdout,v 1.3 2021/09/24 17:37:55 rillig Exp $ */
+/* $NetBSD: opt-fc1.0.stdout,v 1.4 2021/09/25 18:02:48 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -22,3 +22,10 @@
 
 /* $ Both comment texts got surrounded by spaces. */
 /* block1 *//* block2 */
+
+/*
+ * A multi-line comment that starts in column 1.
+ *
+ * followed by another multi-line comment that starts in column 4.
+ */
+/* $ XXX: The two comments have been merged into a single comment. */
diff -r a46923d5c2f1 -r 505b7248bbd1 tests/usr.bin/indent/opt-nfc1.0
--- a/tests/usr.bin/indent/opt-nfc1.0   Sat Sep 25 17:55:37 2021 +0000
+++ b/tests/usr.bin/indent/opt-nfc1.0   Sat Sep 25 18:02:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt-nfc1.0,v 1.3 2021/09/24 17:37:55 rillig Exp $ */
+/* $NetBSD: opt-nfc1.0,v 1.4 2021/09/25 18:02:48 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -23,3 +23,10 @@
 
 /* $ Both comment texts get surrounded by spaces. */
 /*block1*//*block2*/
+
+/*
+ * A multi-line comment that starts
+ * in column 1.
+ *//* followed by another multi-line comment
+ * that starts in column 4.
+ */
diff -r a46923d5c2f1 -r 505b7248bbd1 tests/usr.bin/indent/opt-nfc1.0.stdout
--- a/tests/usr.bin/indent/opt-nfc1.0.stdout    Sat Sep 25 17:55:37 2021 +0000
+++ b/tests/usr.bin/indent/opt-nfc1.0.stdout    Sat Sep 25 18:02:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt-nfc1.0.stdout,v 1.3 2021/09/24 17:37:55 rillig Exp $ */
+/* $NetBSD: opt-nfc1.0.stdout,v 1.4 2021/09/25 18:02:48 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -13,17 +13,34 @@
 /*narrow*/
 
 /* $ The indentation of a single space was preserved. */
-/* $ FIXME: The line must not start with a space. */
+/* $ If the comment were moved to column 1, it would change from the area */
+/* $ of 'comments that may be formatted' to the area of 'comments that must */
+/* $ not be formatted. The indentation of a single space prevents this. */
  /* space */
 
 /* $ The indentation was changed from a single tab to a single space. */
-/* $ FIXME: The line must not start with a space. */
  /* tab        */
 
-/* $ FIXME: The line must not start with a space. */
+/* $ The space between these two comments got removed. */
+/* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
+/* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
+/* $ This is probably because there is a second comment in the same line. */
  /* block1 *//* block2 */
 
-/* $ FIXME: The line must not start with a space. */
-/* $ FIXME: It's inconsistent that the first comment gets no spaces. */
-/* $ FIXME: It's inconsistent that the second comment gets spaces. */
+/* $ It may seem strange at first that the left comment is not touched */
+/* $ but the right comment gets spaces added. This difference is the */
+/* $ exact purpose of the option '-nfc1', which says "do not touch comments */
+/* $ that start in column 1. The first comment starts in column 1, the */
+/* $ second comment doesn't. */
+/* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
+/* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
+/* $ This is probably because there is a second comment in the same line. */
  /*block1*//* block2 */
+
+/*
+ * A multi-line comment that starts
+ * in column 1.
+  *
+  * followed by another multi-line comment that starts in column 4.
+  */
+/* $ XXX: The two comments have been merged into a single comment. */



Home | Main Index | Thread Index | Old Index