1 /* $NetBSD: fmt_block.c,v 1.7 2023/05/22 23:03:16 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 * psym_stmt_list.c 10 */ 11 12 //indent input 13 void 14 function(void) 15 { 16 if (true) { 17 18 } 19 20 { 21 print("block"); 22 } 23 } 24 //indent end 25 26 /* 27 * Before 2023-05-11, indent incorrectly merged the '} {' into a single line, 28 * even though they are completely unrelated. 29 */ 30 //indent run-equals-input 31 32 33 /* 34 * Two adjacent blocks must not be merged. They are typically used in C90 and 35 * earlier to declare local variables with a limited scope. 36 */ 37 //indent input 38 void 39 function(void) 40 { 41 {}{} 42 } 43 //indent end 44 45 //indent run 46 void 47 function(void) 48 { 49 { 50 } 51 { 52 } 53 } 54 //indent end 55 56 //indent run-equals-prev-output -bl 57