Home | History | Annotate | Line # | Download | only in indent
opt_badp.c revision 1.2
      1 /* $NetBSD: opt_badp.c,v 1.2 2021/10/16 09:39:21 rillig Exp $ */
      2 /* $FreeBSD$ */
      3 
      4 /*
      5  * Tests for the options '-badp' and '-nbadp'.
      6  *
      7  * The option '-badp' forces a blank line after the first set of declarations
      8  * in a function. It produces a blank line even if there are no declarations.
      9  */
     10 
     11 #indent input
     12 static void
     13 no_declarations(void)
     14 {
     15 	action();
     16 }
     17 
     18 static void
     19 declarations_without_blank_line(void)
     20 {
     21 	int local_variable;
     22 	action();
     23 }
     24 
     25 static void
     26 declaration_with_blank_line(void)
     27 {
     28 	int local_variable;
     29 
     30 	action();
     31 }
     32 
     33 static void
     34 declaration_with_several_blank_lines(void)
     35 {
     36 	int local_variable;
     37 
     38 
     39 
     40 	action();
     41 }
     42 #indent end
     43 
     44 #indent run -badp
     45 static void
     46 no_declarations(void)
     47 {
     48 
     49 	action();
     50 }
     51 
     52 static void
     53 declarations_without_blank_line(void)
     54 {
     55 	int		local_variable;
     56 	/* $ FIXME: need empty line here */
     57 	action();
     58 }
     59 
     60 static void
     61 declaration_with_blank_line(void)
     62 {
     63 	int		local_variable;
     64 
     65 	action();
     66 }
     67 
     68 static void
     69 declaration_with_several_blank_lines(void)
     70 {
     71 	int		local_variable;
     72 
     73 
     74 
     75 	action();
     76 }
     77 #indent end
     78 
     79 #indent run -nbadp
     80 static void
     81 no_declarations(void)
     82 {
     83 	action();
     84 }
     85 
     86 static void
     87 declarations_without_blank_line(void)
     88 {
     89 	int		local_variable;
     90 	action();
     91 }
     92 
     93 static void
     94 declaration_with_blank_line(void)
     95 {
     96 	int		local_variable;
     97 
     98 	action();
     99 }
    100 
    101 static void
    102 declaration_with_several_blank_lines(void)
    103 {
    104 	int		local_variable;
    105 
    106 
    107 
    108 	action();
    109 }
    110 #indent end
    111