Skip to content

Commit

Permalink
Issue checkstyle#11446: Update AllSinglelineCommentsTest to use verif…
Browse files Browse the repository at this point in the history
…yWithInlineConfigParser
  • Loading branch information
nrmancuso committed Mar 21, 2022
1 parent cd682af commit 39cb36e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 71 deletions.
2 changes: 0 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,6 @@

<exclude>**/SuppressionSingleFilterTest.class</exclude>

<exclude>**/AllSinglelineCommentsTest.class</exclude>

<exclude>**/FileSetCheckTest.class</exclude>

<exclude>**/AbstractFileSetCheckTest.class</exclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ protected String getPackageLocation() {

@Test
public void testAllSinglelineComments() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(SinglelineCommentListenerCheck.class);
final String path = getPath("InputFullOfSinglelineComments.java");
lineSeparator = CheckUtil.getLineSeparatorForFile(path, StandardCharsets.UTF_8);
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
verify(checkConfig, path, expected);
verifyWithInlineConfigParser(path, expected);
assertWithMessage("All comments should be empty")
.that(ALL_COMMENTS)
.isEmpty();
Expand Down Expand Up @@ -83,8 +81,8 @@ public int[] getRequiredTokens() {

@Override
public void init() {
final int lines = 63;
for (int i = 0; i < lines; i++) {
final int lines = 70;
for (int i = 7; i < lines; i++) {
ALL_COMMENTS.add(i + lineSeparator);
}
ALL_COMMENTS.add(String.valueOf(lines));
Expand All @@ -100,4 +98,4 @@ public void visitToken(DetailAST ast) {

}

}
}
Original file line number Diff line number Diff line change
@@ -1,64 +1,70 @@
//0
package//1
com//2
.//3
puppycrawl//4
.//5
tools//6
.//7
checkstyle.grammar//8
.//9
comments//10
//11
//12
;//13
//14
public//15
class//16
InputFullOfSinglelineComments//17
{//18
public//19
static//20
void//21
main//22
(//23
String//24
[//25
]//26
args//27
)//28
{//29
for//30
(//31
int//32
i//33
=//34
0//35
;//36
i//37
<=//38
10//39
;//40
i++//41
)//42
{//43
String//44
line//45
=//46
i//47
+//48
""//49
;//50
/*
com.puppycrawl.tools.checkstyle.grammar.comments.AllSinglelineCommentsTest$SinglelineCommentListenerCheck
*/
//7
package//8
com//9
.//10
puppycrawl//11
.//12
tools//13
.//14
checkstyle.grammar//15
.//16
comments//17
//18
//19
;//20
//21
public//22
class//23
InputFullOfSinglelineComments//24
{//25
public//26
static//27
void//28
main//29
(//30
String//31
[//32
]//33
args//34
)//35
{//36
for//37
(//38
int//39
i//40
=//41
0//42
;//43
i//44
<=//45
10//46
;//47
i++//48
)//49
{//50
String//51
.//52
CASE_INSENSITIVE_ORDER//53
.//54
equals//55
(//56
line//57
)//58
;//59
}//60
}//61
}//62
//63
line//52
=//53
i//54
+//55
""//56
;//57
String//58
.//59
CASE_INSENSITIVE_ORDER//60
.//61
equals//62
(//63
line//64
)//65
;//66
}//67
}//68
}//69
//70

0 comments on commit 39cb36e

Please sign in to comment.