Module Name:    src
Committed By:   rillig
Date:           Sat Sep 25 18:02:49 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: opt-fc1.0 opt-fc1.0.stdout opt-nfc1.0
            opt-nfc1.0.stdout

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/opt-fc1.0 \
    src/tests/usr.bin/indent/opt-fc1.0.stdout \
    src/tests/usr.bin/indent/opt-nfc1.0 \
    src/tests/usr.bin/indent/opt-nfc1.0.stdout

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/indent/opt-fc1.0
diff -u src/tests/usr.bin/indent/opt-fc1.0:1.3 src/tests/usr.bin/indent/opt-fc1.0:1.4
--- src/tests/usr.bin/indent/opt-fc1.0:1.3	Fri Sep 24 17:37:55 2021
+++ src/tests/usr.bin/indent/opt-fc1.0	Sat Sep 25 18:02:48 2021
@@ -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.
+ */
Index: src/tests/usr.bin/indent/opt-fc1.0.stdout
diff -u src/tests/usr.bin/indent/opt-fc1.0.stdout:1.3 src/tests/usr.bin/indent/opt-fc1.0.stdout:1.4
--- src/tests/usr.bin/indent/opt-fc1.0.stdout:1.3	Fri Sep 24 17:37:55 2021
+++ src/tests/usr.bin/indent/opt-fc1.0.stdout	Sat Sep 25 18:02:48 2021
@@ -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. */
Index: src/tests/usr.bin/indent/opt-nfc1.0
diff -u src/tests/usr.bin/indent/opt-nfc1.0:1.3 src/tests/usr.bin/indent/opt-nfc1.0:1.4
--- src/tests/usr.bin/indent/opt-nfc1.0:1.3	Fri Sep 24 17:37:55 2021
+++ src/tests/usr.bin/indent/opt-nfc1.0	Sat Sep 25 18:02:48 2021
@@ -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.
+ */
Index: src/tests/usr.bin/indent/opt-nfc1.0.stdout
diff -u src/tests/usr.bin/indent/opt-nfc1.0.stdout:1.3 src/tests/usr.bin/indent/opt-nfc1.0.stdout:1.4
--- src/tests/usr.bin/indent/opt-nfc1.0.stdout:1.3	Fri Sep 24 17:37:55 2021
+++ src/tests/usr.bin/indent/opt-nfc1.0.stdout	Sat Sep 25 18:02:48 2021
@@ -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. */

Reply via email to