Module Name: src
Committed By: rillig
Date: Thu Sep 30 22:45:34 UTC 2021
Modified Files:
src/tests/usr.bin/indent: comment-line-end.0 comment-line-end.0.stdout
token-lparen.0 token-lparen.0.stdout
Log Message:
tests/indent: add more tests with ')(', found bug in '//'
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/comment-line-end.0 \
src/tests/usr.bin/indent/comment-line-end.0.stdout
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/token-lparen.0
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/token-lparen.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/comment-line-end.0
diff -u src/tests/usr.bin/indent/comment-line-end.0:1.7 src/tests/usr.bin/indent/comment-line-end.0:1.8
--- src/tests/usr.bin/indent/comment-line-end.0:1.7 Fri Sep 24 16:29:31 2021
+++ src/tests/usr.bin/indent/comment-line-end.0 Thu Sep 30 22:45:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: comment-line-end.0,v 1.7 2021/09/24 16:29:31 rillig Exp $ */
+/* $NetBSD: comment-line-end.0,v 1.8 2021/09/30 22:45:34 rillig Exp $ */
/* $FreeBSD$ */
/*
@@ -33,4 +33,12 @@ foo(); // C++ comment
bar();
}
+void
+comment_at_end_of_function(void)
+{
+ if (cond)
+ statement();
+ // comment
+}
+
// end-of-line comment at the end of the file
Index: src/tests/usr.bin/indent/comment-line-end.0.stdout
diff -u src/tests/usr.bin/indent/comment-line-end.0.stdout:1.7 src/tests/usr.bin/indent/comment-line-end.0.stdout:1.8
--- src/tests/usr.bin/indent/comment-line-end.0.stdout:1.7 Fri Sep 24 16:29:31 2021
+++ src/tests/usr.bin/indent/comment-line-end.0.stdout Thu Sep 30 22:45:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: comment-line-end.0.stdout,v 1.7 2021/09/24 16:29:31 rillig Exp $ */
+/* $NetBSD: comment-line-end.0.stdout,v 1.8 2021/09/30 22:45:34 rillig Exp $ */
/* $FreeBSD$ */
/*
@@ -37,6 +37,17 @@ c99_comment(void)
bar();
}
+void
+comment_at_end_of_function(void)
+{
+ if (cond)
+ statement();
+/* $ FIXME: The next line is indented with tab-space, should be tab. */
+ // comment
+
+/* $ FIXME: The above line has 1 trailing space. */
+}
+
// end-of-line comment at the end of the file
/* $ FIXME: the extra empty line above this line is wrong. */
Index: src/tests/usr.bin/indent/token-lparen.0
diff -u src/tests/usr.bin/indent/token-lparen.0:1.2 src/tests/usr.bin/indent/token-lparen.0:1.3
--- src/tests/usr.bin/indent/token-lparen.0:1.2 Tue Sep 28 06:57:48 2021
+++ src/tests/usr.bin/indent/token-lparen.0 Thu Sep 30 22:45:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-lparen.0,v 1.2 2021/09/28 06:57:48 rillig Exp $ */
+/* $NetBSD: token-lparen.0,v 1.3 2021/09/30 22:45:34 rillig Exp $ */
/* $FreeBSD$ */
/*
@@ -27,6 +27,17 @@ function(void)
{
other_function();
other_function("first", 2, "last argument"[4]);
+
+ if (false)(void)x;
+ if (false)(func)(arg);
+ if (false)(cond)?123:456;
+
+ /* C99 compound literal */
+ origin = (struct point){0,0};
+
+ /* GCC statement expression */
+ /* expr = ({if(expr)debug();expr;}); */
+/* $ XXX: Generates wrong 'Error@36: Unbalanced parens'. */
}
int array[] = {
Index: src/tests/usr.bin/indent/token-lparen.0.stdout
diff -u src/tests/usr.bin/indent/token-lparen.0.stdout:1.4 src/tests/usr.bin/indent/token-lparen.0.stdout:1.5
--- src/tests/usr.bin/indent/token-lparen.0.stdout:1.4 Thu Sep 30 21:48:12 2021
+++ src/tests/usr.bin/indent/token-lparen.0.stdout Thu Sep 30 22:45:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-lparen.0.stdout,v 1.4 2021/09/30 21:48:12 rillig Exp $ */
+/* $NetBSD: token-lparen.0.stdout,v 1.5 2021/09/30 22:45:34 rillig Exp $ */
/* $FreeBSD$ */
/*
@@ -27,6 +27,21 @@ function(void)
{
other_function();
other_function("first", 2, "last argument"[4]);
+
+ if (false)
+ (void)x;
+ if (false)
+ (func)(arg);
+ if (false)
+ (cond) ? 123 : 456;
+
+ /* C99 compound literal */
+ origin = (struct point){
+ 0, 0
+ };
+
+ /* GCC statement expression */
+ /* expr = ({if(expr)debug();expr;}); */
}
int array[] = {