xref: /netbsd-src/tests/usr.bin/indent/opt_cd.c (revision 65e3242c1e7ce8e4fda93bdaae8c93d7270ffe07)
1 /* $NetBSD: opt_cd.c,v 1.5 2023/06/17 22:09:24 rillig Exp $ */
2 
3 /*
4  * Tests for the '-cd' option, which sets the column (not the indentation) for
5  * declarations.
6  */
7 
8 //indent input
9 int global_var; /* declaration comment */
10 stmt; /* declaration comment, as the code in this line starts at indentation level 0 */
11 
12 {
13 	int local_var	/* unfinished declaration */
14 	;		/* finished declaration */
15 	stmt;		/* statement */
16 }
17 //indent end
18 
19 //indent run -cd49
20 int		global_var;			/* declaration comment */
21 stmt;						/* declaration comment, as the
22 						 * code in this line starts at
23 						 * indentation level 0 */
24 
25 {
26 	int		local_var		/* unfinished declaration */
27 // $ XXX: Why is the semicolon indented one column to the left?
28 		       ;			/* finished declaration */
29 	stmt;			/* statement */
30 }
31 //indent end
32 
33 /* If '-cd' is not given, it falls back to '-c'. */
34 //indent run -c49
35 int		global_var;			/* declaration comment */
36 stmt;						/* declaration comment, as the
37 						 * code in this line starts at
38 						 * indentation level 0 */
39 
40 {
41 	int		local_var		/* unfinished declaration */
42 // $ XXX: Why is the semicolon indented one column to the left?
43 		       ;			/* finished declaration */
44 	stmt;					/* statement */
45 }
46 //indent end
47