Home | History | Annotate | Line # | Download | only in indent
opt_fcb.c revision 1.5
      1 /* $NetBSD: opt_fcb.c,v 1.5 2021/11/20 16:54:17 rillig Exp $ */
      2 /* $FreeBSD$ */
      3 
      4 /*
      5  * Tests for the options '-fcb' and '-nfcb'.
      6  *
      7  * The option '-fcb' formats block comments (ones that begin with '/' '*'
      8  * '\n').
      9  *
     10  * The option '-nfcb' preserves block comments, like other box comments.
     11  */
     12 
     13 /*
     14  * The following comment starts with '/' '*' '\n'.
     15  */
     16 #indent input
     17 /*
     18  * Block
     19  * comment
     20  * with delimiters.
     21  */
     22 #indent end
     23 
     24 #indent run -fcb
     25 /*
     26  * Block comment with delimiters.
     27  */
     28 #indent end
     29 
     30 #indent run-equals-input -nfcb
     31 
     32 
     33 /*
     34  * The following comment does not count as a block comment since it has a word
     35  * in its first line.
     36  */
     37 #indent input
     38 /* Not
     39  *
     40  * a block
     41  *      comment. */
     42 #indent end
     43 
     44 #indent run -fcb
     45 /*
     46  * Not
     47  *
     48  * a block comment.
     49  */
     50 #indent end
     51 
     52 #indent run-equals-prev-output -nfcb
     53 
     54 
     55 /*
     56  * Block comments that start with '-' or another '*' are always preserved.
     57  */
     58 #indent input
     59 /*-
     60  * car         mat         men
     61  *    efu   for   ted   com   t
     62  *       lly         box       .
     63  */
     64 #indent end
     65 
     66 #indent run-equals-input -fcb
     67 #indent run-equals-input -nfcb
     68 
     69 
     70 /*
     71  * The option '-fcb' does not distinguish between comments at the top level
     72  * and comments in functions.
     73  */
     74 #indent input
     75 void
     76 example(void)
     77 {
     78 	/* Not
     79 	 *
     80 	 * a block
     81 	 *      comment */
     82 }
     83 #indent end
     84 
     85 #indent run -fcb
     86 void
     87 example(void)
     88 {
     89 	/*
     90 	 * Not
     91 	 *
     92 	 * a block comment
     93 	 */
     94 }
     95 #indent end
     96 
     97 #indent run-equals-prev-output -nfcb
     98 
     99 
    100 #indent input
    101 void
    102 example(void)
    103 {
    104 	/*
    105 	 * This is
    106 	 *
    107 	 * a block
    108 	 *	comment.
    109 	 */
    110 }
    111 #indent end
    112 
    113 #indent run -fcb
    114 void
    115 example(void)
    116 {
    117 	/*
    118 	 * This is
    119 	 *
    120 	 * a block comment.
    121 	 */
    122 }
    123 #indent end
    124 
    125 #indent run-equals-input -nfcb
    126 
    127 
    128 #indent input
    129 void
    130 example(void)
    131 {
    132 	/*-
    133 	 * car         mat         men
    134 	 *    efu   for   ted   com   t
    135 	 *       lly         box       .
    136 	 */
    137 }
    138 #indent end
    139 
    140 #indent run-equals-input -fcb
    141 #indent run-equals-input -nfcb
    142