@@ -29,6 +29,7 @@ void testTrailingSpaceShouldAddIssue() {
2929 .withCheck (new TrailingWhitespaceCheck ())
3030 .onFile (
3131 new DelphiTestUnitBuilder ()
32+ .appendImpl ("// Fix qf@[+2:17 to +2:18] <<>>" )
3233 .appendImpl ("// Noncompliant@+1" )
3334 .appendImpl ("var Foo: TObject; " ))
3435 .verifyIssues ();
@@ -40,6 +41,7 @@ void testTrailingTabShouldAddIssue() {
4041 .withCheck (new TrailingWhitespaceCheck ())
4142 .onFile (
4243 new DelphiTestUnitBuilder ()
44+ .appendImpl ("// Fix qf@[+2:17 to +2:18] <<>>" )
4345 .appendImpl ("// Noncompliant@+1" )
4446 .appendImpl ("var Foo: TObject;\t " ))
4547 .verifyIssues ();
@@ -51,11 +53,25 @@ void testTrailingMixedWhitespaceShouldAddIssue() {
5153 .withCheck (new TrailingWhitespaceCheck ())
5254 .onFile (
5355 new DelphiTestUnitBuilder ()
56+ .appendImpl ("// Fix qf@[+2:17 to +2:26] <<>>" )
5457 .appendImpl ("// Noncompliant@+1" )
5558 .appendImpl ("var Foo: TObject;\t \t \t \t " ))
5659 .verifyIssues ();
5760 }
5861
62+ @ Test
63+ void testTrailingSpaceOnFollowingLineShouldAddIssue () {
64+ CheckVerifier .newVerifier ()
65+ .withCheck (new TrailingWhitespaceCheck ())
66+ .onFile (
67+ new DelphiTestUnitBuilder ()
68+ .appendImpl ("// Fix qf@[+3:0 to +3:3] <<>>" )
69+ .appendImpl ("// Noncompliant@+2" )
70+ .appendImpl ("var Foo: TObject;" )
71+ .appendImpl (" " ))
72+ .verifyIssues ();
73+ }
74+
5975 @ Test
6076 void testNoTrailingWhitespaceShouldNotAddIssue () {
6177 CheckVerifier .newVerifier ()
@@ -71,4 +87,91 @@ void testLeadingWhitespaceShouldNotAddIssue() {
7187 .onFile (new DelphiTestUnitBuilder ().appendImpl ("\t \t \t var Foo: TObject;" ))
7288 .verifyNoIssues ();
7389 }
90+
91+ @ Test
92+ void testNoTrailingSpaceInLineCommentShouldNotAddIssue () {
93+ CheckVerifier .newVerifier ()
94+ .withCheck (new TrailingWhitespaceCheck ())
95+ .onFile (
96+ new DelphiTestUnitBuilder ().appendImpl ("// there is no trailing whitespace in here" ))
97+ .verifyNoIssues ();
98+ }
99+
100+ @ Test
101+ void testTrailingSpaceInLineCommentShouldAddIssue () {
102+ CheckVerifier .newVerifier ()
103+ .withCheck (new TrailingWhitespaceCheck ())
104+ .onFile (
105+ new DelphiTestUnitBuilder ()
106+ .appendImpl ("// Fix qf@[+2:42 to +2:43] <<>>" )
107+ .appendImpl ("// Noncompliant@+1" )
108+ .appendImpl ("// hey, there's a trailing spaces in here! " ))
109+ .verifyIssues ();
110+ }
111+
112+ @ Test
113+ void testTrailingTabsInLineCommentShouldAddIssue () {
114+ CheckVerifier .newVerifier ()
115+ .withCheck (new TrailingWhitespaceCheck ())
116+ .onFile (
117+ new DelphiTestUnitBuilder ()
118+ .appendImpl ("// Fix qf@[+2:39 to +2:40] <<>>" )
119+ .appendImpl ("// Noncompliant@+1" )
120+ .appendImpl ("// hey, there's a trailing tab in here!\t " ))
121+ .verifyIssues ();
122+ }
123+
124+ @ Test
125+ void testNoTrailingSpaceInMultilineCommentShouldNotAddIssue () {
126+ CheckVerifier .newVerifier ()
127+ .withCheck (new TrailingWhitespaceCheck ())
128+ .onFile (
129+ new DelphiTestUnitBuilder ()
130+ .appendImpl ("{" )
131+ .appendImpl (" there is no trailing whitespace in here" )
132+ .appendImpl ("}" ))
133+ .verifyNoIssues ();
134+ }
135+
136+ @ Test
137+ void testTrailingSpaceInMultilineCommentShouldAddIssue () {
138+ CheckVerifier .newVerifier ()
139+ .withCheck (new TrailingWhitespaceCheck ())
140+ .onFile (
141+ new DelphiTestUnitBuilder ()
142+ .appendImpl ("// Fix qf@[+3:40 to +3:41] <<>>" )
143+ .appendImpl ("// Noncompliant@+2" )
144+ .appendImpl ("{" )
145+ .appendImpl (" hey, there's a trailing space in here! " )
146+ .appendImpl ("}" ))
147+ .verifyIssues ();
148+ }
149+
150+ @ Test
151+ void testTrailingTabInMultilineCommentShouldAddIssue () {
152+ CheckVerifier .newVerifier ()
153+ .withCheck (new TrailingWhitespaceCheck ())
154+ .onFile (
155+ new DelphiTestUnitBuilder ()
156+ .appendImpl ("// Fix qf@[+3:38 to +3:39] <<>>" )
157+ .appendImpl ("// Noncompliant@+2" )
158+ .appendImpl ("{" )
159+ .appendImpl (" hey, there's a trailing tab in here!\t " )
160+ .appendImpl ("}" ))
161+ .verifyIssues ();
162+ }
163+
164+ @ Test
165+ void testTrailingSpaceOnFirstLineOfMultilineCommentWithOffsetShouldAddIssue () {
166+ CheckVerifier .newVerifier ()
167+ .withCheck (new TrailingWhitespaceCheck ())
168+ .onFile (
169+ new DelphiTestUnitBuilder ()
170+ .appendImpl ("// Fix qf@[+2:6 to +2:7] <<>>" )
171+ .appendImpl ("// Noncompliant@+1" )
172+ .appendImpl (" {\t " )
173+ .appendImpl (" hey, there's a trailing tab up there!" )
174+ .appendImpl ("}" ))
175+ .verifyIssues ();
176+ }
74177}
0 commit comments