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 token '('



details:   https://anonhg.NetBSD.org/src/rev/432647769b99
branches:  trunk
changeset: 361532:432647769b99
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 13 12:04:37 2022 +0000

description:
tests/indent: test token '('

There are already some tests in token_lparen.c that need to be merged.

diffstat:

 tests/usr.bin/indent/lsym_lparen_or_lbracket.c |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r a10e20dd3d66 -r 432647769b99 tests/usr.bin/indent/lsym_lparen_or_lbracket.c
--- a/tests/usr.bin/indent/lsym_lparen_or_lbracket.c    Sun Feb 13 11:07:48 2022 +0000
+++ b/tests/usr.bin/indent/lsym_lparen_or_lbracket.c    Sun Feb 13 12:04:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.2 2022/02/13 11:07:48 rillig Exp $ */
+/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.3 2022/02/13 12:04:37 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -21,8 +21,26 @@
  * In an expression, '(' followed by a type name starts a cast expression.
  */
 
+// TODO: Add systematic tests for all cases.
+
 #indent input
-// TODO: add input
+void
+function(void)
+{
+       /* Type casts */
+       a = (int)b;
+       a = (struct tag)b;
+       /* TODO: The '(int)' is not a type cast, it is a prototype list. */
+       a = (int (*)(int))fn;
+
+       /* Not type casts */
+       a = sizeof(int) * 2;
+       a = sizeof(5) * 2;
+       a = offsetof(struct stat, st_mtime);
+
+       /* Grouping subexpressions */
+       a = ((((b + c)))) * d;
+}
 #indent end
 
 #indent run-equals-input



Home | Main Index | Thread Index | Old Index