New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pull #14518: move AllBlockCommentTest and AllSinglelineCommentsTest to AST Tests #14518
Conversation
fb9b6d6
to
06e1785
Compare
4d05d2f
to
1e3ba14
Compare
I think CI failure is unrelated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items:
src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/AllBlockCommentsTest.java
Outdated
Show resolved
Hide resolved
@@ -48,14 +44,15 @@ protected String getPackageLocation() { | |||
|
|||
@Test | |||
public void testAllBlockComments() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please investigate a bit and leave a comment above this test method (or class) that describes why we need such a strange test. If it is not obvious, let's remove it completely and see what fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nrmancuso Honestly idk I found it weird too. just updated it to be an example for the issue. but I will investigate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahfouz72 if CI is green in #14537, please just do as I have there and delete this class completely. Make sure to grep for this class name to remove any mentions of it as well.
Edit: CI is green, let's proceed with removal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nrmancuso should I close this PR? or just update it after the removal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Input file that is full of block multi line comments https://github.com/checkstyle/checkstyle/blob/master/src/test/resources/com/puppycrawl/tools/checkstyle/grammar/comments/InputFullOfBlockComments.java
We just need to change
/*0*//*1*/package/*2*/ com/*3*/./*4*/puppycrawl/*5*/./*6*/tools/*7*/./*8*/checkstyle.grammar/*9*/./*10*/comments/*11*/;/*12*/
/*13*/
To more verbose:
/*0*//*1*/package/*2*/ com/*3*/./*4*/puppycrawl/*5*/./*6*/tools/*7*/./*8*/checkstyle.grammar/*9*/./*10*/comments/*11*/;/*12*/
// 12 violations above:
//. '0'
//. '1'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test just test our ability to detect comments at any possible place. It might not be required for coverage but it helps to control parsing
Ok, then let’s create a test for the AST with comments generated by this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, good idea, this is exactly what we wanted many years ago, but we did not have this concept at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahfouz72 , please move this test to AST tests
Example:
checkstyle/src/test/java/com/puppycrawl/tools/checkstyle/grammar/AstRegressionTest.java
Lines 73 to 76 in 8531fec
public void testAdvanceJava9TryWithResourcesAstTree() throws Exception { | |
verifyAst(getPath("ExpectedAdvanceJava9TryWithResources.txt"), | |
getPath("/java9/InputAdvanceJava9TryWithResources.java")); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/AllBlockCommentsTest.java
Outdated
Show resolved
Hide resolved
2105173
to
f077d26
Compare
f077d26
to
1acdedc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to clean things up, @mahfouz72 thanks a lot for this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comment above
1acdedc
to
29efa7d
Compare
29efa7d
to
98a8e8a
Compare
98a8e8a
to
e836d0b
Compare
@romani please review |
…entsTest to AST Tests
e836d0b
to
46c167d
Compare
…entsTest to AST Tests
46c167d
to
ed6b713
Compare
…entsTest to AST Tests
ed6b713
to
724d04d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of back and forth on this one, @mahfouz72 thanks for hanging in there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this update, it becomes much better
issue #14249: