summaryrefslogtreecommitdiff
path: root/tests/usr.bin/indent/opt_cd.c
blob: 38d9958727cc1bc0af182d06aa75143251d9be16 (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
/* $NetBSD: opt_cd.c,v 1.5 2023/06/17 22:09:24 rillig Exp $ */

/*
 * Tests for the '-cd' option, which sets the column (not the indentation) for
 * declarations.
 */

//indent input
int global_var; /* declaration comment */
stmt; /* declaration comment, as the code in this line starts at indentation level 0 */

{
	int local_var	/* unfinished declaration */
	;		/* finished declaration */
	stmt;		/* statement */
}
//indent end

//indent run -cd49
int		global_var;			/* declaration comment */
stmt;						/* declaration comment, as the
						 * code in this line starts at
						 * indentation level 0 */

{
	int		local_var		/* unfinished declaration */
// $ XXX: Why is the semicolon indented one column to the left?
		       ;			/* finished declaration */
	stmt;			/* statement */
}
//indent end

/* If '-cd' is not given, it falls back to '-c'. */
//indent run -c49
int		global_var;			/* declaration comment */
stmt;						/* declaration comment, as the
						 * code in this line starts at
						 * indentation level 0 */

{
	int		local_var		/* unfinished declaration */
// $ XXX: Why is the semicolon indented one column to the left?
		       ;			/* finished declaration */
	stmt;					/* statement */
}
//indent end