xref: /netbsd-src/tests/usr.bin/indent/lsym_if.c (revision 3117ece4fc4a4ca4489ba793710b60b0d26bab6c)
1 /* $NetBSD: lsym_if.c,v 1.6 2023/06/10 18:46:42 rillig Exp $ */
2 
3 /*
4  * Tests for the token lsym_if, which represents the keyword 'if' that starts
5  * an 'if' or 'if-else' statement.
6  */
7 
8 //indent input
9 void
10 function(void)
11 {
12 	if(cond)stmt();
13 }
14 //indent end
15 
16 //indent run
17 void
18 function(void)
19 {
20 	if (cond)
21 		stmt();
22 }
23 //indent end
24 
25 
26 /*
27  * After an 'if' statement without an 'else' branch, braces start a separate
28  * block.
29  */
30 //indent input
31 {
32 	if(0)if(1)if(2)stmt();{}
33 }
34 //indent end
35 
36 //indent run
37 {
38 	if (0)
39 		if (1)
40 			if (2)
41 				stmt();
42 	{
43 	}
44 }
45 //indent end
46