xref: /netbsd-src/tests/usr.bin/indent/lsym_rparen_or_rbracket.c (revision 2fbaf64cd1a7772abada04c14331ca60de8a7821)
1 /* $NetBSD: lsym_rparen_or_rbracket.c,v 1.8 2023/06/16 14:26:27 rillig Exp $ */
2 
3 /*
4  * Tests for the token lsym_rparen_or_lbracket, which represents ')' or ']',
5  * the counterparts for '(' and '['.
6  *
7  * See also:
8  *	lsym_lparen_or_lbracket.c
9  */
10 
11 //indent input
12 int var = (3);
13 int cast = (int)3;
14 int cast = (int)(3);
15 int call = function(3);
16 int array[3] = {1, 2, 3};
17 int array[3] = {[2] = 3};
18 //indent end
19 
20 //indent run-equals-input -di0
21 
22 
23 //indent input
24 int a = array[
25 3
26 ];
27 {
28 int a = array[
29 3
30 ];
31 }
32 //indent end
33 
34 //indent run -di0
35 int a = array[
36 	      3
37 ];
38 {
39 	int a = array[
40 		      3
41 // $ FIXME: Should be one level to the left since it is the outermost bracket.
42 		];
43 }
44 //indent end
45 
46 //indent run -di0 -nlp
47 int a = array[
48 	3
49 ];
50 {
51 	int a = array[
52 		3
53 // $ FIXME: Should be one level to the left since it is the outermost bracket.
54 		];
55 }
56 //indent end
57 
58 
59 /*
60  * Cast expressions and compound expressions, taken from lint and make.
61  */
62 //indent input
63 // This ')' is not a cast.
64 char *Buf_DoneData(Buffer *) MAKE_ATTR_USE;
65 
66 {
67 	dcs_align((u_int)dcs);
68 	mpools.pools[i] = (memory_pool){NULL, 0, 0};
69 	list_add(l, (const char[3]){'-', (char)c, '\0'});
70 }
71 //indent end
72 
73 //indent run-equals-input -ci4 -di0 -nlp
74