1 1.4 rillig /* $NetBSD: opt_fc1.c,v 1.4 2021/10/18 07:11:31 rillig Exp $ */ 2 1.1 rillig /* $FreeBSD$ */ 3 1.1 rillig 4 1.3 rillig /* 5 1.3 rillig * Tests for the options '-fc1' and '-nfc1'. 6 1.3 rillig * 7 1.3 rillig * The option '-fc1' formats comments in column 1. 8 1.3 rillig * 9 1.3 rillig * The option '-nfc1' prevents comments in column 1 as is. 10 1.3 rillig */ 11 1.3 rillig 12 1.1 rillig #indent input 13 1.1 rillig /* 14 1.1 rillig * A comment 15 1.1 rillig * in column 1. 16 1.1 rillig * 17 1.1 rillig * 18 1.1 rillig * 19 1.1 rillig */ 20 1.3 rillig #indent end 21 1.3 rillig 22 1.3 rillig #indent run -fc1 23 1.3 rillig /* 24 1.3 rillig * A comment in column 1. 25 1.3 rillig * 26 1.3 rillig * 27 1.3 rillig * 28 1.3 rillig */ 29 1.3 rillig #indent end 30 1.3 rillig 31 1.4 rillig #indent run-equals-input -nfc1 32 1.3 rillig 33 1.1 rillig 34 1.3 rillig #indent input 35 1.1 rillig /* $ Neither indentation nor surrounding spaces. */ 36 1.1 rillig /*narrow*/ 37 1.1 rillig 38 1.1 rillig /* $ Indented by a single space, single spaces around the text. */ 39 1.1 rillig /* space */ 40 1.1 rillig 41 1.1 rillig /* $ Indented by a single tab, single tabs around the text. */ 42 1.1 rillig /* tab */ 43 1.1 rillig 44 1.1 rillig /* $ The space between these comments gets removed. */ 45 1.1 rillig /* block1 */ /* block2 */ 46 1.1 rillig 47 1.1 rillig /* $ Both comment texts get surrounded by spaces. */ 48 1.1 rillig /*block1*//*block2*/ 49 1.1 rillig #indent end 50 1.1 rillig 51 1.1 rillig #indent run -fc1 52 1.1 rillig /* $ The comment text got surrounded by spaces. */ 53 1.1 rillig /* narrow */ 54 1.1 rillig 55 1.1 rillig /* $ The indentation got removed. */ 56 1.1 rillig /* space */ 57 1.1 rillig 58 1.1 rillig /* $ The indentation got removed, only the leading tab got replaced by a space. */ 59 1.1 rillig /* tab */ 60 1.1 rillig 61 1.1 rillig /* $ The space between these comments got removed. */ 62 1.1 rillig /* block1 *//* block2 */ 63 1.1 rillig 64 1.1 rillig /* $ Both comment texts got surrounded by spaces. */ 65 1.1 rillig /* block1 *//* block2 */ 66 1.1 rillig #indent end 67 1.1 rillig 68 1.1 rillig #indent run -nfc1 69 1.1 rillig /* $ No spaces got added around the comment text. */ 70 1.1 rillig /*narrow*/ 71 1.1 rillig 72 1.1 rillig /* $ The indentation of a single space was preserved. */ 73 1.1 rillig /* $ If the comment were moved to column 1, it would change from the area */ 74 1.1 rillig /* $ of 'comments that may be formatted' to the area of 'comments that must */ 75 1.1 rillig /* $ not be formatted. The indentation of a single space prevents this. */ 76 1.1 rillig /* space */ 77 1.1 rillig 78 1.1 rillig /* $ The indentation was changed from a single tab to a single space. */ 79 1.1 rillig /* tab */ 80 1.1 rillig 81 1.1 rillig /* $ The space between these two comments got removed. */ 82 1.1 rillig /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */ 83 1.1 rillig /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */ 84 1.1 rillig /* $ This is probably because there is a second comment in the same line. */ 85 1.1 rillig /* block1 *//* block2 */ 86 1.1 rillig 87 1.1 rillig /* $ It may seem strange at first that the left comment is not touched */ 88 1.1 rillig /* $ but the right comment gets spaces added. This difference is the */ 89 1.1 rillig /* $ exact purpose of the option '-nfc1', which says "do not touch comments */ 90 1.1 rillig /* $ that start in column 1. The first comment starts in column 1, the */ 91 1.1 rillig /* $ second comment doesn't. */ 92 1.1 rillig /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */ 93 1.1 rillig /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */ 94 1.1 rillig /* $ This is probably because there is a second comment in the same line. */ 95 1.1 rillig /*block1*//* block2 */ 96 1.3 rillig #indent end 97 1.1 rillig 98 1.3 rillig 99 1.3 rillig #indent input 100 1.3 rillig /* 101 1.3 rillig * A multi-line comment that starts 102 1.3 rillig * in column 1. 103 1.3 rillig *//* followed by another multi-line comment 104 1.3 rillig * that starts in column 4. 105 1.3 rillig */ 106 1.3 rillig #indent end 107 1.3 rillig 108 1.3 rillig #indent run -fc1 109 1.3 rillig /* 110 1.3 rillig * A multi-line comment that starts in column 1. 111 1.3 rillig * 112 1.3 rillig * followed by another multi-line comment that starts in column 4. 113 1.3 rillig */ 114 1.3 rillig /* $ XXX: The two comments have been merged into a single comment. */ 115 1.3 rillig #indent end 116 1.3 rillig 117 1.3 rillig #indent run -nfc1 118 1.1 rillig /* 119 1.1 rillig * A multi-line comment that starts 120 1.1 rillig * in column 1. 121 1.1 rillig * 122 1.1 rillig * followed by another multi-line comment that starts in column 4. 123 1.1 rillig */ 124 1.1 rillig /* $ XXX: The two comments have been merged into a single comment. */ 125 1.3 rillig #indent end 126 1.1 rillig 127 1.3 rillig 128 1.3 rillig #indent input 129 1.3 rillig /* comment */ int decl2; /* comment */ 130 1.3 rillig /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */ 131 1.3 rillig /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */ 132 1.3 rillig #indent end 133 1.3 rillig 134 1.3 rillig #indent run -fc1 135 1.3 rillig /* comment */ int decl2; /* comment */ 136 1.3 rillig /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */ 137 1.3 rillig /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong 138 1.3 rillig * second comment */ 139 1.3 rillig #indent end 140 1.3 rillig 141 1.4 rillig #indent run-equals-prev-output -nfc1 142