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: add more tests with ')(',...



details:   https://anonhg.NetBSD.org/src/rev/e502fd7a9241
branches:  trunk
changeset: 987537:e502fd7a9241
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 30 22:45:34 2021 +0000

description:
tests/indent: add more tests with ')(', found bug in '//'

diffstat:

 tests/usr.bin/indent/comment-line-end.0        |  10 +++++++++-
 tests/usr.bin/indent/comment-line-end.0.stdout |  13 ++++++++++++-
 tests/usr.bin/indent/token-lparen.0            |  13 ++++++++++++-
 tests/usr.bin/indent/token-lparen.0.stdout     |  17 ++++++++++++++++-
 4 files changed, 49 insertions(+), 4 deletions(-)

diffs (107 lines):

diff -r a368ef4493c9 -r e502fd7a9241 tests/usr.bin/indent/comment-line-end.0
--- a/tests/usr.bin/indent/comment-line-end.0   Thu Sep 30 21:48:12 2021 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0   Thu Sep 30 22:45:34 2021 +0000
@@ -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 @@
 bar();
 }
 
+void
+comment_at_end_of_function(void)
+{
+    if (cond)
+       statement();
+    // comment
+}
+
 // end-of-line comment at the end of the file
diff -r a368ef4493c9 -r e502fd7a9241 tests/usr.bin/indent/comment-line-end.0.stdout
--- a/tests/usr.bin/indent/comment-line-end.0.stdout    Thu Sep 30 21:48:12 2021 +0000
+++ b/tests/usr.bin/indent/comment-line-end.0.stdout    Thu Sep 30 22:45:34 2021 +0000
@@ -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 @@
        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. */
diff -r a368ef4493c9 -r e502fd7a9241 tests/usr.bin/indent/token-lparen.0
--- a/tests/usr.bin/indent/token-lparen.0       Thu Sep 30 21:48:12 2021 +0000
+++ b/tests/usr.bin/indent/token-lparen.0       Thu Sep 30 22:45:34 2021 +0000
@@ -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 @@
 {
     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[] = {
diff -r a368ef4493c9 -r e502fd7a9241 tests/usr.bin/indent/token-lparen.0.stdout
--- a/tests/usr.bin/indent/token-lparen.0.stdout        Thu Sep 30 21:48:12 2021 +0000
+++ b/tests/usr.bin/indent/token-lparen.0.stdout        Thu Sep 30 22:45:34 2021 +0000
@@ -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 @@
 {
        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[] = {



Home | Main Index | Thread Index | Old Index