xref: /netbsd-src/tests/usr.bin/indent/opt_bap_sob.c (revision 2718af68c3efc72c9769069b5c7f9ed36f6b9def)
1 /* $NetBSD: opt_bap_sob.c,v 1.2 2021/11/19 22:24:29 rillig Exp $ */
2 /* $FreeBSD$ */
3 
4 /*
5  * As of 2021-03-08, the combination of -bap and -sob, which occurs in the
6  * example indent.pro from NetBSD, removes the empty line above the
7  * separator.  Seen in games/cgram/cgram.c.
8  */
9 
10 #indent input
11 void
12 function1(void)
13 {
14 }
15 
16 ///// C99 separator /////
17 
18 void
19 function2(void)
20 {
21 }
22 
23 /* C block separator */
24 
25 void
26 function3(void)
27 {
28 }
29 #indent end
30 
31 #indent run -bap -sob
32 void
33 function1(void)
34 {
35 }
36 /* $ FIXME: Keep the empty line between the '}' and the '//'. */
37 ///// C99 separator /////
38 
39 void
40 function2(void)
41 {
42 }
43 /* $ FIXME: Keep the empty line. */
44 /* C block separator */
45 
46 void
47 function3(void)
48 {
49 }
50 #indent end
51 
52 /*
53  * XXX: Strangely, the option '-nbap' keeps the empty lines after the
54  * function bodies.  That's exactly the opposite of the behavior that's
55  * described in the manual.
56  */
57 #indent run-equals-input -nbap -sob
58 
59 /*
60  * Without '-sob', the option '-bap' works as intended.
61  */
62 #indent run-equals-input -bap
63