summaryrefslogtreecommitdiff
path: root/tests/usr.bin/indent/lsym_if.c
blob: 6725b4ff8d721c04bb3c72aea7cd34d4ea75f36a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* $NetBSD: lsym_if.c,v 1.6 2023/06/10 18:46:42 rillig Exp $ */

/*
 * Tests for the token lsym_if, which represents the keyword 'if' that starts
 * an 'if' or 'if-else' statement.
 */

//indent input
void
function(void)
{
	if(cond)stmt();
}
//indent end

//indent run
void
function(void)
{
	if (cond)
		stmt();
}
//indent end


/*
 * After an 'if' statement without an 'else' branch, braces start a separate
 * block.
 */
//indent input
{
	if(0)if(1)if(2)stmt();{}
}
//indent end

//indent run
{
	if (0)
		if (1)
			if (2)
				stmt();
	{
	}
}
//indent end