xref: /netbsd-src/tests/usr.bin/indent/opt_sc.c (revision 65e3242c1e7ce8e4fda93bdaae8c93d7270ffe07)
1 /* $NetBSD: opt_sc.c,v 1.8 2023/06/17 22:09:24 rillig Exp $ */
2 
3 /*
4  * Tests for the options '-sc' and '-nsc'.
5  *
6  * The option '-sc' starts continuation lines of block comments with " * ".
7  *
8  * The option '-nsc' does not use asterisks for aligning the continuation
9  * lines of comments.
10  */
11 
12 //indent input
13 /* comment
14 without
15 asterisks
16 */
17 //indent end
18 
19 //indent run -sc
20 /*
21  * comment without asterisks
22  */
23 //indent end
24 
25 //indent run -nsc
26 /*
27 comment without asterisks
28  */
29 //indent end
30 
31 
32 //indent input
33 /*
34 ** This comment style is used by Lua.
35 */
36 //indent end
37 
38 //indent run -sc
39 /*
40 // $ XXX: The additional '*' is debatable.
41  * * This comment style is used by Lua.
42  */
43 //indent end
44 
45 //indent run -nsc
46 /*
47 // $ This comment, as rewritten by indent, is not actually used by Lua.
48  * This comment style is used by Lua.
49  */
50 //indent end
51 
52 
53 /*
54  * Comments that start with '*' or '-' do not get modified at all.
55  */
56 //indent input
57 /**
58  * Javadoc, adopted by several other programming languages.
59  */
60 //indent end
61 
62 //indent run-equals-input -sc
63 
64 //indent run-equals-input -nsc
65 
66 
67 /*
68  * Ensure that blank lines in comments are preserved. Multiple adjacent blank
69  * lines are preserved as well.
70  */
71 //indent input
72 /*
73 paragraph 1
74 
75 
76 paragraph 2
77 */
78 //indent end
79 
80 //indent run -sc
81 /*
82  * paragraph 1
83  *
84  *
85  * paragraph 2
86  */
87 //indent end
88 
89 //indent run -nsc
90 /*
91 // $ XXX: paragraph 1 is indented, paragraph 2 isn't.
92  paragraph 1
93 
94 
95 paragraph 2
96  */
97 //indent end
98