1 /* $NetBSD: fmt_block.c,v 1.8 2023/06/14 20:46:08 rillig Exp $ */
2
3 /*
4 * Tests for formatting blocks of statements and declarations.
5 *
6 * See also:
7 * lsym_lbrace.c
8 * psym_stmt.c
9 */
10
11 //indent input
12 void
function(void)13 function(void)
14 {
15 if (true) {
16
17 }
18
19 {
20 print("block");
21 }
22 }
23 //indent end
24
25 /*
26 * Before 2023-05-11, indent incorrectly merged the '} {' into a single line,
27 * even though they are completely unrelated.
28 */
29 //indent run-equals-input
30
31
32 /*
33 * Two adjacent blocks must not be merged. They are typically used in C90 and
34 * earlier to declare local variables with a limited scope.
35 */
36 //indent input
37 void
function(void)38 function(void)
39 {
40 {}{}
41 }
42 //indent end
43
44 //indent run
45 void
function(void)46 function(void)
47 {
48 {
49 }
50 {
51 }
52 }
53 //indent end
54
55 //indent run-equals-prev-output -bl
56