xref: /netbsd-src/tests/usr.bin/indent/opt_cli.c (revision 53b02e147d4ed531c0d2a5ca9b3e8026ba3e99b5)
1 /* $NetBSD: opt_cli.c,v 1.3 2021/11/28 16:05:59 rillig Exp $ */
2 /* $FreeBSD$ */
3 
4 /*
5  * Tests for the option '-cli' ("case label indentation"), which sets the
6  * amount of indentation of a 'case' relative to the surrounding 'switch',
7  * measured in indentation levels.
8  *
9  * See also:
10  *	lsym_case_label.c
11  */
12 
13 #indent input
14 void
15 classify(int n)
16 {
17 	switch (n) {
18 	case 0: print("zero"); break;
19 	case 1: print("one"); break;
20 	case 2: case 3: print("prime"); break;
21 	case 4: print("square"); break;
22 	default: print("large"); break;
23 	}
24 }
25 #indent end
26 
27 #indent run -cli0.5
28 void
29 classify(int n)
30 {
31 	switch (n) {
32 	    case 0:
33 		print("zero");
34 		break;
35 	    case 1:
36 		print("one");
37 		break;
38 	    case 2:
39 	    case 3:
40 		print("prime");
41 		break;
42 	    case 4:
43 		print("square");
44 		break;
45 	    default:
46 		print("large");
47 		break;
48 	}
49 }
50 #indent end
51 
52 #indent run -cli1.5
53 void
54 classify(int n)
55 {
56 	switch (n) {
57 		    case 0:
58 			print("zero");
59 			break;
60 		    case 1:
61 			print("one");
62 			break;
63 		    case 2:
64 		    case 3:
65 			print("prime");
66 			break;
67 		    case 4:
68 			print("square");
69 			break;
70 		    default:
71 			print("large");
72 			break;
73 	}
74 }
75 #indent end
76