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: test comment to the right...



details:   https://anonhg.NetBSD.org/src/rev/52d8cc3054b7
branches:  trunk
changeset: 989500:52d8cc3054b7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 14 20:00:59 2021 +0000

description:
tests/indent: test comment to the right, collect more useful tests

diffstat:

 tests/usr.bin/indent/token-comment.0        |  43 +++++++++++++++++++++++-
 tests/usr.bin/indent/token-comment.0.stdout |  52 ++++++++++++++++++++++++++++-
 2 files changed, 93 insertions(+), 2 deletions(-)

diffs (117 lines):

diff -r 6993d1cec91d -r 52d8cc3054b7 tests/usr.bin/indent/token-comment.0
--- a/tests/usr.bin/indent/token-comment.0      Thu Oct 14 18:55:41 2021 +0000
+++ b/tests/usr.bin/indent/token-comment.0      Thu Oct 14 20:00:59 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0,v 1.11 2021/10/12 21:08:37 rillig Exp $ */
+/* $NetBSD: token-comment.0,v 1.12 2021/10/14 20:00:59 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -190,3 +190,44 @@
        while(cond)
        /*comment*/;
 }
+
+/*
+ * The following comment starts really far to the right. To avoid that each
+ * line only contains a single word, the maximum allowed line width is
+ * extended such that each comment line may contain 22 characters.
+ */
+int global_variable_with_really_long_name_that_reaches_up_to_column_xx;        /* 1234567890123456789 1 1234567890123456789 12 1234567890123456789 123 1234567890123456789 1234 1234567890123456789 
12345 1234567890123456789 123456 */
+
+/*-
+ * TODO: systematically test comments
+ *
+ * - starting in column 1, with opt.format_col1_comments
+ * - starting in column 1, without opt.format_col1_comments
+ * - starting in column 9, independent of opt.format_col1_comments
+ * - starting in column 33, the default
+ * - starting in column 65, which is already close to the default right margin
+ * - starting in column 81, spilling into the right margin
+ *
+ * - block comment starting with '/' '*' '-'
+ * - block comment starting with '/' '*' '*'
+ * - block comment starting with '/' '*' '\n'
+ * - end-of-line comment starting with '//'
+ * - end-of-line comment starting with '//x', so without leading space
+ * - block comment starting with '/' '*' 'x', so without leading space
+ *
+ * - block/end-of-line comment to the right of a label
+ * - block/end-of-line comment to the right of code
+ * - block/end-of-line comment to the right of label with code
+ *
+ * - with/without opt.comment_delimiter_on_blankline
+ * - with/without opt.star_comment_cont
+ * - with/without opt.format_block_comments
+ * - with varying opt.max_line_length (32, 64, 80, 140)
+ * - with varying opt.unindent_displace (0, 2, -5)
+ * - with varying opt.indent_size (3, 4, 8)
+ * - with varying opt.tabsize (3, 4, 8, 16)
+ * - with varying opt.block_comment_max_line_length (60, 78, 90)
+ * - with varying opt.decl_comment_column (0, 1, 33, 80)
+ * - with/without ps.decl_on_line
+ * - with/without ps.last_nl
+ */
diff -r 6993d1cec91d -r 52d8cc3054b7 tests/usr.bin/indent/token-comment.0.stdout
--- a/tests/usr.bin/indent/token-comment.0.stdout       Thu Oct 14 18:55:41 2021 +0000
+++ b/tests/usr.bin/indent/token-comment.0.stdout       Thu Oct 14 20:00:59 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0.stdout,v 1.13 2021/10/12 21:08:37 rillig Exp $ */
+/* $NetBSD: token-comment.0.stdout,v 1.14 2021/10/14 20:00:59 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -220,3 +220,53 @@
 /* $ XXX: The spaces around the comment look unintentional. */
                 /* comment */ ;
 }
+
+/*
+ * The following comment starts really far to the right. To avoid that each
+ * line only contains a single word, the maximum allowed line width is
+ * extended such that each comment line may contain 22 characters.
+ */
+int            global_variable_with_really_long_name_that_reaches_up_to_column_xx;     /* 1234567890123456789 1
+                                                                                        * 1234567890123456789 12
+                                                                                        * 1234567890123456789
+                                                                                        * 123
+                                                                                        * 1234567890123456789
+                                                                                        * 1234
+                                                                                        * 1234567890123456789
+                                                                                        * 12345
+                                                                                        * 1234567890123456789
+                                                                                        * 123456 */
+
+/*-
+ * TODO: systematically test comments
+ *
+ * - starting in column 1, with opt.format_col1_comments
+ * - starting in column 1, without opt.format_col1_comments
+ * - starting in column 9, independent of opt.format_col1_comments
+ * - starting in column 33, the default
+ * - starting in column 65, which is already close to the default right margin
+ * - starting in column 81, spilling into the right margin
+ *
+ * - block comment starting with '/' '*' '-'
+ * - block comment starting with '/' '*' '*'
+ * - block comment starting with '/' '*' '\n'
+ * - end-of-line comment starting with '//'
+ * - end-of-line comment starting with '//x', so without leading space
+ * - block comment starting with '/' '*' 'x', so without leading space
+ *
+ * - block/end-of-line comment to the right of a label
+ * - block/end-of-line comment to the right of code
+ * - block/end-of-line comment to the right of label with code
+ *
+ * - with/without opt.comment_delimiter_on_blankline
+ * - with/without opt.star_comment_cont
+ * - with/without opt.format_block_comments
+ * - with varying opt.max_line_length (32, 64, 80, 140)
+ * - with varying opt.unindent_displace (0, 2, -5)
+ * - with varying opt.indent_size (3, 4, 8)
+ * - with varying opt.tabsize (3, 4, 8, 16)
+ * - with varying opt.block_comment_max_line_length (60, 78, 90)
+ * - with varying opt.decl_comment_column (0, 1, 33, 80)
+ * - with/without ps.decl_on_line
+ * - with/without ps.last_nl
+ */



Home | Main Index | Thread Index | Old Index