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