-
Notifications
You must be signed in to change notification settings - Fork 6
Issue #15: provide UT for correct patch file loading that contains multiple files in it #16
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
Conversation
9b04e8f
to
aa86174
Compare
src/test/resources/com/github/checkstyle/patchfilter/PatchFileFromDiffTools/GitDiffPatch.txt
Outdated
Show resolved
Hide resolved
@HuGanghui , please explain what problem in patch loading we have , that you raised at java-diff-utils/java-diff-utils#82 . Please create issue on them in our issue tracker. If no problem ... please close issue in library and post solution to close comment. |
@romani no problem on java-diff-utils/java-diff-utils#82, I have closed it. |
aa86174
to
06c822f
Compare
@HuGanghui , please remove from this PR updates on SuppressionPatchFilterElement.java this pure patch load test(different styles), no relationship to Checkstyle at all. if you need upodate in Filter , please make separate issue on this and it will come after this PR. |
06c822f
to
ab8a42e
Compare
@romani done, I have removed from this PR updates on SuppressionPatchFilterElement.java |
I do not understand why this test needy filter. |
@romani, because there is a issue java-diff-utils/java-diff-utils#83 in java-diff-utils when one patch file have multiple files , so I deal with this situation by ourself in patch-filters/src/main/java/com/github/checkstyle/patchfilter/SuppressionPatchFilter.java Lines 99 to 165 in 7898201
so in test I need filter. |
@HuGanghui we don't know yet whether it's a bug or a specific behavior. If you meet any problem while testing that library please create an issue on their side AND mark your test which fails with So, please remove all checkstyle references and use library only as @romani mentioned. |
@rdiachenko thanks, I will do it |
ab8a42e
to
da7d5c2
Compare
@Ignore("error: com.github.difflib.unifieddiff.UnifiedDiffParserException: " | ||
+ "expected file start line not found") | ||
public void testGitFormatPatchLinuxTwo() 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.
there is a error when test GitFormatPatchLinuxTwo file
@Ignore("filename parsed error, Expected :<tests/test-check-pyflakes.t>, " | ||
+ "Actual :<tests/test-check-pyflakes.t\tTue Jun 09 17:13:26 2020 -0400>\n") | ||
public void testHgDiffPatch() 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.
there is a filename parsed error when test HgDiffPatch file
@Ignore("https://github.com/java-diff-utils/java-diff-utils/issues/83") | ||
public void testMultiChangedFilesOnOnePatchOne() 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.
there is a issue when test problem_diff_issue51.diff
assertEquals("diff -U0 old/f1 new/f1", file1.getDiffCommand()); | ||
// here is f1 not old/f1 and new/f1 | ||
assertEquals("f1", file1.getFromFile()); | ||
assertEquals("f1", file1.getToFile()); |
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.
according to parse convention:
https://github.com/java-diff-utils/java-diff-utils/blob/a8e4ce2eff297c7700a6215bacb548e30151b948/java-diff-utils/src/main/java/com/github/difflib/unifieddiff/UnifiedDiffReader.java#L124-L130
there should be old/f1 and new/f1
assertEquals("diff -U0 old/f2 new/f2", file2.getDiffCommand()); | ||
// same issue here is f2 not old/f2 and new/f2 | ||
assertEquals("f2", file2.getFromFile()); | ||
assertEquals("f2", file2.getToFile()); |
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.
same as above
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.
Same here.
Please put old/f2
and new/f2
in assetEquals. Once issue-83 is fixed in the library, this test should successfully pass.
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.
Since all these tests do not test a patch filter, I think they should not be located in SuppressionPatchFilterTest
and should be moved to a new class (for example, DiffFormatsTest
).
@romani , do you agree?
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
c4c7ee7
to
6d0355a
Compare
yes, Tests should be out Filter test, there should be no reference to Filters/check and checkstyle at all in this test. |
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:
...esources/com/github/checkstyle/patchfilter/PatchFileFromDiffTools/GitFormatPatchLinuxTwo.txt
Outdated
Show resolved
Hide resolved
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Outdated
Show resolved
Hide resolved
assertEquals("diff -U0 old/f2 new/f2", file2.getDiffCommand()); | ||
// same issue here is f2 not old/f2 and new/f2 | ||
assertEquals("f2", file2.getFromFile()); | ||
assertEquals("f2", file2.getToFile()); |
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.
Same here.
Please put old/f2
and new/f2
in assetEquals. Once issue-83 is fixed in the library, this test should successfully pass.
a8dd3cd
to
418e55f
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.
Items to improve:
src/test/java/com/github/checkstyle/patchfilter/SuppressionPatchFilterTest.java
Show resolved
Hide resolved
src/test/resources/com/github/checkstyle/patchfilter/BoundaryTestPatchOne.txt
Outdated
Show resolved
Hide resolved
…ontains multiple files in it
418e55f
to
4cc3fd9
Compare
Issue #15: provide UT for correct patch file loading that contains multiple files in it
I add all cases in comments to UT, and now UT just check changed lines statistics.
And because fields are private so I use reflection.