summaryrefslogtreecommitdiff
path: root/tests/usr.bin/indent/psym_rbrace.c
blob: 79d966966e0fe79fb40aa5455a7f2723e834d350 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* $NetBSD: psym_rbrace.c,v 1.5 2023/06/16 23:19:01 rillig Exp $ */

/*
 * Tests for the parser symbol psym_rbrace, which represents '}' and finishes
 * the previous '{'.
 *
 * See also:
 *	psym_lbrace.c
 */


/*
 * While it is a syntax error to have an unfinished declaration between braces,
 * indent is forgiving enough to accept this input.
 */
//indent input
{
	int
}
//indent end

//indent run
{
	int
	}
// exit 1
// error: Standard Input:3: Statement nesting error
// error: Standard Input:3: Stuff missing from end of file
//indent end


//indent input
{
	do {
	} while (cond)
}
//indent end

// XXX: Why doesn't indent complain about the missing semicolon?
//indent run-equals-input


//indent input
{
	if (cond)
}
//indent end

//indent run
{
	if (cond)
		}
// exit 1
// error: Standard Input:3: Statement nesting error
// error: Standard Input:3: Stuff missing from end of file
//indent end


//indent input
{
	switch (expr)
}
//indent end

//indent run
{
	switch (expr)
		}
// exit 1
// error: Standard Input:3: Statement nesting error
// error: Standard Input:3: Stuff missing from end of file
//indent end


//indent input
{
	while (cond)
}
//indent end

//indent run
{
	while (cond)
		}
// exit 1
// error: Standard Input:3: Statement nesting error
// error: Standard Input:3: Stuff missing from end of file
//indent end