Module Name: src
Committed By: rillig
Date: Sat Jun 17 22:09:25 UTC 2023
Modified Files:
src/tests/usr.bin/indent: edge_cases.c lsym_comment.c lsym_funcname.c
lsym_lparen_or_lbracket.c lsym_tag.c lsym_typedef.c lsym_unary_op.c
lsym_word.c opt_T.c opt_bad.c opt_bbb.c opt_bc.c opt_cd.c opt_sc.c
Log Message:
tests/indent: add miscellaneous test cases found during clean up
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/edge_cases.c
cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/lsym_funcname.c \
src/tests/usr.bin/indent/lsym_word.c
cvs rdiff -u -r1.18 -r1.19 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/lsym_tag.c
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/lsym_typedef.c \
src/tests/usr.bin/indent/opt_bbb.c
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/lsym_unary_op.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/opt_T.c \
src/tests/usr.bin/indent/opt_cd.c
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_bad.c
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/indent/opt_bc.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/opt_sc.c
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/edge_cases.c
diff -u src/tests/usr.bin/indent/edge_cases.c:1.3 src/tests/usr.bin/indent/edge_cases.c:1.4
--- src/tests/usr.bin/indent/edge_cases.c:1.3 Sun Jun 4 18:58:30 2023
+++ src/tests/usr.bin/indent/edge_cases.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: edge_cases.c,v 1.3 2023/06/04 18:58:30 rillig Exp $ */
+/* $NetBSD: edge_cases.c,v 1.4 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for edge cases in the C programming language that indent does not
@@ -44,3 +44,135 @@ number = array <:subscript: >;
/* TODO: test trigraphs, which are as unusual as digraphs */
/* TODO: test digraphs and trigraphs in string literals, just for fun */
+
+
+/*
+ * The keywords 'break', 'continue', 'goto' and 'restrict' are ordinary words,
+ * they do not force a line break before.
+ */
+//indent input
+{
+ Whether to break or not to break, that is the question;
+
+ The people goto the shopping mall;
+
+ Begin at the beginning, then continue until you come to the end;
+ then stop;
+
+ Try to restrict yourself;
+}
+//indent end
+
+//indent run-equals-input -di0
+
+
+/*
+ * Try a bit of Perl code, just for fun, taken from pkgsrc/pkgtools/pkglint4.
+ *
+ * It works surprisingly well.
+ */
+//indent input
+package PkgLint::Line;
+
+use strict;
+use warnings;
+
+BEGIN {
+ import PkgLint::Util qw(
+ false true
+ assert
+ );
+}
+
+use enum qw(FNAME LINES TEXT PHYSLINES CHANGED BEFORE AFTER EXTRA);
+
+sub new($$$$) {
+ my ($class, $fname, $lines, $text, $physlines) = @_;
+ my ($self) = ([$fname, $lines, $text, $physlines, false, [], [], {}]);
+ bless($self, $class);
+ return $self;
+}
+
+sub fname($) { return shift()->[FNAME]; }
+
+# querying, getting and setting the extra values.
+sub has($$) {
+ my ($self, $name) = @_;
+ return exists($self->[EXTRA]->{$name});
+}
+//indent end
+
+//indent run -di0 -nfbs -npsl
+// $ Space after '::'.
+package PkgLint:: Line;
+
+use strict;
+use warnings;
+
+BEGIN {
+// $ Space after '::'.
+ import PkgLint:: Util qw(
+ false true
+ assert
+ );
+}
+
+// $ Space between 'qw' and '('.
+use enum qw (FNAME LINES TEXT PHYSLINES CHANGED BEFORE AFTER EXTRA);
+
+sub new($$$$) {
+// $ No space between 'my' and '('.
+ my($class, $fname, $lines, $text, $physlines) = @_;
+ my($self) = ([$fname, $lines, $text, $physlines, false, [], [], {
+// $ Line break between '{' and '}'.
+ }
+// $ Line break between '}' and ']'.
+ ]);
+ bless($self, $class);
+ return $self;
+}
+
+sub fname($) {
+ return shift()->[FNAME];
+}
+
+// $ Preprocessing lines are mostly preserved.
+# querying, getting and setting the extra values.
+sub has($$) {
+ my($self, $name) = @_;
+ return exists($self->[EXTRA]->{
+// $ Line breaks between '{', '$name', '}' and ');'.
+ $name
+ }
+ );
+}
+// exit 1
+// error: Standard Input:17: Unbalanced parentheses
+// warning: Standard Input:17: Extra ']'
+// warning: Standard Input:17: Extra ')'
+// error: Standard Input:27: Unbalanced parentheses
+// warning: Standard Input:27: Extra ')'
+//indent end
+
+
+/*
+ * Try a piece of old-style JavaScript, just for fun, using '==' instead of the
+ * now recommended '==='.
+ */
+//indent input
+function join(delim, values)
+{
+ if (values.length == 0)
+ return '';
+ if (values.length == 1)
+ return values[0];
+ var result = '';
+ for (var i in values) {
+ result += delim;
+ result += values[i];
+ }
+ return result.substr(delim.length);
+}
+//indent end
+
+//indent run-equals-input -di0 -npsl
Index: src/tests/usr.bin/indent/lsym_comment.c
diff -u src/tests/usr.bin/indent/lsym_comment.c:1.21 src/tests/usr.bin/indent/lsym_comment.c:1.22
--- src/tests/usr.bin/indent/lsym_comment.c:1.21 Wed Jun 14 09:31:05 2023
+++ src/tests/usr.bin/indent/lsym_comment.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_comment.c,v 1.21 2023/06/14 09:31:05 rillig Exp $ */
+/* $NetBSD: lsym_comment.c,v 1.22 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the token lsym_comment, which starts a comment.
@@ -1144,3 +1144,54 @@ int block; /* comment line 1 comment l
// $ FIXME: It's a comment, not code.
/*/ comment ? or : not; /* */
//indent end
+
+
+/*
+ * The tokens '/' and '*' do not form a comment when they are separated by a
+ * space.
+ */
+//indent input
+int a = b / *c;
+// $ Indent can be tricked into treating '/' as a unary operator, thus turning
+// $ some operators into the start of a comment. This only works in
+// $ syntactically invalid text.
+int a = b + / * c;
+//indent end
+
+//indent run -di0
+int a = b / *c;
+// $ FIXME: Don't merge the two operators; there are enough situations where
+// $ indent has to guess whether an operator is unary or binary, and these
+// $ heuristics can go wrong.
+int a = b + /*c;
+//indent end
+
+
+/*
+ * Ensure that tab characters that are broken into separate lines are replaced
+ * with spaces; other tabs are preserved.
+ */
+//indent input
+/* word word word word word word word word word */
+//indent end
+
+//indent run -l38
+/*
+ * word word word word word
+ * word word word word
+ */
+//indent end
+
+
+/* In no-wrap comments, every single newline is preserved. */
+//indent input
+/*-
+paragraph 1
+
+
+
+paragraph 2
+ */
+//indent end
+
+//indent run-equals-input
Index: src/tests/usr.bin/indent/lsym_funcname.c
diff -u src/tests/usr.bin/indent/lsym_funcname.c:1.6 src/tests/usr.bin/indent/lsym_funcname.c:1.7
--- src/tests/usr.bin/indent/lsym_funcname.c:1.6 Thu Jun 15 09:19:07 2023
+++ src/tests/usr.bin/indent/lsym_funcname.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_funcname.c,v 1.6 2023/06/15 09:19:07 rillig Exp $ */
+/* $NetBSD: lsym_funcname.c,v 1.7 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the token lsym_funcname, which is the name of a function, but only
@@ -33,3 +33,32 @@ function_with_comment(void)
//indent end
//indent run-equals-input
+
+
+/*
+ * The heuristics for telling a function definition and a function declaration
+ * apart look at the remaining characters in a line but don't tokenize them.
+ * Due to that, a ');' in a comment influences the heuristics.
+ */
+//indent input
+// $ This ');' in the comment does not mark the end of the declaration.
+void heuristics_semicolon_comment(/* ); */) {}
+void heuristics_semicolon_no_comm(/* -- */) {}
+void heuristics_comma_comment(/* ), */) {}
+void heuristics_comma_no_comm(/* -- */) {}
+//indent end
+
+//indent run -di0
+void heuristics_semicolon_comment(/* ); */) {
+}
+void
+heuristics_semicolon_no_comm(/* -- */)
+{
+}
+void heuristics_comma_comment(/* ), */) {
+}
+void
+heuristics_comma_no_comm(/* -- */)
+{
+}
+//indent end
Index: src/tests/usr.bin/indent/lsym_word.c
diff -u src/tests/usr.bin/indent/lsym_word.c:1.6 src/tests/usr.bin/indent/lsym_word.c:1.7
--- src/tests/usr.bin/indent/lsym_word.c:1.6 Sun Apr 24 10:36:37 2022
+++ src/tests/usr.bin/indent/lsym_word.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_word.c,v 1.6 2022/04/24 10:36:37 rillig Exp $ */
+/* $NetBSD: lsym_word.c,v 1.7 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the token lsym_word, which represents a constant, a string
@@ -14,6 +14,10 @@
// TODO: Add more systematic tests.
// TODO: Completely cover each state transition in lex_number_state.
+// TODO: Consider splitting this token into lsym_name and lsym_value, to
+// TODO: make it easier to skip tokens during lookahead, for example since
+// TODO: L"" is not an identifier but a string literal.
+
//indent input
// TODO: add input
//indent end
Index: src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c
diff -u src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.18 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.19
--- src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.18 Fri Jun 16 23:07:52 2023
+++ src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.18 2023/06/16 23:07:52 rillig Exp $ */
+/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.19 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the token lsym_lparen_or_lbracket, which represents a '(' or '['
@@ -355,3 +355,24 @@ int arr[] = {
['1'] = 2,
};
//indent end
+
+
+/* In an initializer, a '(' does not start a function definition. */
+//indent input
+{
+type var = {
+.CONCAT(a, b)
+= init,
+};
+}
+
+//indent end
+
+//indent run
+{
+ type var = {
+ .CONCAT(a, b)
+ = init,
+ };
+}
+//indent end
Index: src/tests/usr.bin/indent/lsym_tag.c
diff -u src/tests/usr.bin/indent/lsym_tag.c:1.9 src/tests/usr.bin/indent/lsym_tag.c:1.10
--- src/tests/usr.bin/indent/lsym_tag.c:1.9 Thu Jun 15 10:34:12 2023
+++ src/tests/usr.bin/indent/lsym_tag.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_tag.c,v 1.9 2023/06/15 10:34:12 rillig Exp $ */
+/* $NetBSD: lsym_tag.c,v 1.10 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the token lsym_tag, which represents one of the keywords
@@ -156,3 +156,24 @@ enum multi_line {
//indent run-equals-input -ci4
//indent run-equals-input -ci4 -nlp
+
+
+/*
+ * When 'typedef' or a tag is followed by a name, that name marks a type and a
+ * following '*' marks a pointer type.
+ */
+//indent input
+{
+ // $ Syntactically invalid but shows that '*' is not multiplication.
+ a = struct x * y;
+ a = (struct x * y)z;
+}
+//indent end
+
+//indent run
+{
+ // $ Everything before the '*' is treated as a declaration.
+ a = struct x *y;
+ a = (struct x *y)z;
+}
+//indent end
Index: src/tests/usr.bin/indent/lsym_typedef.c
diff -u src/tests/usr.bin/indent/lsym_typedef.c:1.8 src/tests/usr.bin/indent/lsym_typedef.c:1.9
--- src/tests/usr.bin/indent/lsym_typedef.c:1.8 Fri Jun 16 12:30:45 2023
+++ src/tests/usr.bin/indent/lsym_typedef.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_typedef.c,v 1.8 2023/06/16 12:30:45 rillig Exp $ */
+/* $NetBSD: lsym_typedef.c,v 1.9 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the token lsym_typedef, which represents the keyword 'typedef'
@@ -90,3 +90,24 @@ struct {
//indent end
//indent run-equals-input -di0
+
+
+/*
+ * When 'typedef' or a tag is followed by a name, that name marks a type and a
+ * following '*' marks a pointer type.
+ */
+//indent input
+{
+ // $ Syntactically invalid but shows that '*' is not multiplication.
+ a = typedef name * y;
+ a = (typedef x * y)z;
+}
+//indent end
+
+//indent run
+{
+ // $ Everything before the '*' is treated as a declaration.
+ a = typedef name *y;
+ a = (typedef x *y)z;
+}
+//indent end
Index: src/tests/usr.bin/indent/opt_bbb.c
diff -u src/tests/usr.bin/indent/opt_bbb.c:1.8 src/tests/usr.bin/indent/opt_bbb.c:1.9
--- src/tests/usr.bin/indent/opt_bbb.c:1.8 Sat May 20 11:19:17 2023
+++ src/tests/usr.bin/indent/opt_bbb.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bbb.c,v 1.8 2023/05/20 11:19:17 rillig Exp $ */
+/* $NetBSD: opt_bbb.c,v 1.9 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the options '-bbb' and '-nbbb'.
@@ -65,3 +65,25 @@ function_definition(void)
//indent end
//indent run-equals-input -nbbb
+
+
+//indent input
+{
+label: /* not a block comment */
+ stmt; /* not a block comment */
+ /**
+ * block comment
+ */
+}
+//indent end
+
+//indent run -bbb
+{
+label: /* not a block comment */
+ stmt; /* not a block comment */
+
+ /**
+ * block comment
+ */
+}
+//indent end
Index: src/tests/usr.bin/indent/lsym_unary_op.c
diff -u src/tests/usr.bin/indent/lsym_unary_op.c:1.11 src/tests/usr.bin/indent/lsym_unary_op.c:1.12
--- src/tests/usr.bin/indent/lsym_unary_op.c:1.11 Fri Jun 16 12:55:57 2023
+++ src/tests/usr.bin/indent/lsym_unary_op.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_unary_op.c,v 1.11 2023/06/16 12:55:57 rillig Exp $ */
+/* $NetBSD: lsym_unary_op.c,v 1.12 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the token lsym_unary_op, which represents a unary operator.
@@ -92,3 +92,27 @@ unary_operators(void)
//indent end
//indent run-equals-input -di0
+
+
+/* All asterisks from a pointer type are merged into a single token. */
+//indent input
+{
+char*
+*
+*
+*x;
+char
+*
+*
+*
+*x;
+}
+//indent end
+
+//indent run
+{
+ char ****x;
+ char
+ ****x;
+}
+//indent end
Index: src/tests/usr.bin/indent/opt_T.c
diff -u src/tests/usr.bin/indent/opt_T.c:1.4 src/tests/usr.bin/indent/opt_T.c:1.5
--- src/tests/usr.bin/indent/opt_T.c:1.4 Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_T.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_T.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_T.c,v 1.5 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the option '-T', which specifies a single identifier that indent
@@ -33,3 +33,20 @@ int mult = (unknown_type_name) * arg;
/* See the option -ta for handling these types. */
int suff = (unknown_type_name_t) * arg;
//indent end
+
+
+/*
+ * The keyword table has precedence over the custom-specified types; otherwise,
+ * the following lines would be declarations, and the declarators would be
+ * indented by 16.
+ */
+//indent input
+{
+ break x;
+ continue x;
+ goto x;
+ return x;
+}
+//indent end
+
+//indent run-equals-input -Tbreak -Tcontinue -Tgoto -Treturn
Index: src/tests/usr.bin/indent/opt_cd.c
diff -u src/tests/usr.bin/indent/opt_cd.c:1.4 src/tests/usr.bin/indent/opt_cd.c:1.5
--- src/tests/usr.bin/indent/opt_cd.c:1.4 Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_cd.c Sat Jun 17 22:09:24 2023
@@ -1,12 +1,46 @@
-/* $NetBSD: opt_cd.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_cd.c,v 1.5 2023/06/17 22:09:24 rillig Exp $ */
+
+/*
+ * Tests for the '-cd' option, which sets the column (not the indentation) for
+ * declarations.
+ */
//indent input
-int aflag; /* Apply to all files. */
+int global_var; /* declaration comment */
+stmt; /* declaration comment, as the code in this line starts at indentation level 0 */
+
+{
+ int local_var /* unfinished declaration */
+ ; /* finished declaration */
+ stmt; /* statement */
+}
//indent end
//indent run -cd49
-int aflag; /* Apply to all files. */
+int global_var; /* declaration comment */
+stmt; /* declaration comment, as the
+ * code in this line starts at
+ * indentation level 0 */
+
+{
+ int local_var /* unfinished declaration */
+// $ XXX: Why is the semicolon indented one column to the left?
+ ; /* finished declaration */
+ stmt; /* statement */
+}
//indent end
/* If '-cd' is not given, it falls back to '-c'. */
-//indent run-equals-prev-output -c49
+//indent run -c49
+int global_var; /* declaration comment */
+stmt; /* declaration comment, as the
+ * code in this line starts at
+ * indentation level 0 */
+
+{
+ int local_var /* unfinished declaration */
+// $ XXX: Why is the semicolon indented one column to the left?
+ ; /* finished declaration */
+ stmt; /* statement */
+}
+//indent end
Index: src/tests/usr.bin/indent/opt_bad.c
diff -u src/tests/usr.bin/indent/opt_bad.c:1.10 src/tests/usr.bin/indent/opt_bad.c:1.11
--- src/tests/usr.bin/indent/opt_bad.c:1.10 Sun May 14 16:47:06 2023
+++ src/tests/usr.bin/indent/opt_bad.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bad.c,v 1.10 2023/05/14 16:47:06 rillig Exp $ */
+/* $NetBSD: opt_bad.c,v 1.11 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the options '-bad' and '-nbad'.
@@ -165,3 +165,24 @@ initializer_with_blank(void)
//indent end
//indent run-equals-input -ldi0 -nbad
+
+
+//indent input
+{
+ int decl;
+ /* comment */
+ int decl;
+}
+//indent end
+
+//indent run -bad -di0
+{
+ int decl;
+// $ FIXME: This blank line is _between_ the declarations, not _after_ them.
+
+ /* comment */
+ int decl;
+// $ XXX: This blank line is unnecessary, it doesn't occur in practice, though.
+
+}
+//indent end
Index: src/tests/usr.bin/indent/opt_bc.c
diff -u src/tests/usr.bin/indent/opt_bc.c:1.12 src/tests/usr.bin/indent/opt_bc.c:1.13
--- src/tests/usr.bin/indent/opt_bc.c:1.12 Wed Jun 14 20:46:08 2023
+++ src/tests/usr.bin/indent/opt_bc.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bc.c,v 1.12 2023/06/14 20:46:08 rillig Exp $ */
+/* $NetBSD: opt_bc.c,v 1.13 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the options '-bc' and '-nbc'.
@@ -149,3 +149,57 @@ int a, b, c;
const struct paren_level *prev = state.prev_ps.paren.item, *curr = ps.paren.item;
}
//indent end
+
+
+/*
+ * In struct or union declarations, the declarators are split onto separate
+ * lines, just like in ordinary declarations.
+ *
+ * In enum declarations and in initializers, no line breaks are added or
+ * removed.
+ */
+//indent input
+struct triple_struct {
+ int a, b, c;
+};
+union triple_union {
+ int a, b, c;
+};
+enum triple_enum {
+ triple_a, triple_b,
+
+ triple_c,
+};
+//indent end
+
+//indent run -bc
+struct triple_struct {
+ int a,
+ b,
+ c;
+};
+union triple_union {
+ int a,
+ b,
+ c;
+};
+enum triple_enum {
+ triple_a, triple_b,
+
+ triple_c,
+};
+//indent end
+
+//indent run -nbc
+struct triple_struct {
+ int a, b, c;
+};
+union triple_union {
+ int a, b, c;
+};
+enum triple_enum {
+ triple_a, triple_b,
+
+ triple_c,
+};
+//indent end
Index: src/tests/usr.bin/indent/opt_sc.c
diff -u src/tests/usr.bin/indent/opt_sc.c:1.7 src/tests/usr.bin/indent/opt_sc.c:1.8
--- src/tests/usr.bin/indent/opt_sc.c:1.7 Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_sc.c Sat Jun 17 22:09:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_sc.c,v 1.7 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_sc.c,v 1.8 2023/06/17 22:09:24 rillig Exp $ */
/*
* Tests for the options '-sc' and '-nsc'.
@@ -35,16 +35,16 @@ comment without asterisks
*/
//indent end
-/* XXX: The additional '*' is debatable. */
//indent run -sc
/*
+// $ XXX: The additional '*' is debatable.
* * This comment style is used by Lua.
*/
//indent end
-/* This comment, as rewritten by indent, is not actually used by Lua. */
//indent run -nsc
/*
+// $ This comment, as rewritten by indent, is not actually used by Lua.
* This comment style is used by Lua.
*/
//indent end
@@ -62,3 +62,36 @@ comment without asterisks
//indent run-equals-input -sc
//indent run-equals-input -nsc
+
+
+/*
+ * Ensure that blank lines in comments are preserved. Multiple adjacent blank
+ * lines are preserved as well.
+ */
+//indent input
+/*
+paragraph 1
+
+
+paragraph 2
+*/
+//indent end
+
+//indent run -sc
+/*
+ * paragraph 1
+ *
+ *
+ * paragraph 2
+ */
+//indent end
+
+//indent run -nsc
+/*
+// $ XXX: paragraph 1 is indented, paragraph 2 isn't.
+ paragraph 1
+
+
+paragraph 2
+ */
+//indent end