You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What conditions are missed by the existing tests?
In any case, if new tests are needed, they should follow the existing syntax.
Or better, such tests should be independent.
In short, it lacks situations I added.
In details, it lacks:
"" and "\n" (also includes "" and "\r", "" and "\r\n"...)
because "" is very tricky, and it is hard to say it for sure whether we think them equal.
"a\n" and "a\n\n"
This might sounds stupid, but actually very tricky. because. this function think "a" equals "a\n", but it thinks "a\n" not equals "a\n\n".
Only a non-CRLF char can be follow a ending CRLF and cause no difference to original, in this function.
and another related tricky example is "a\n" and "a\r\n"be equal.
some Readers who same to itself.
The existing tests only have some examples for a same Object, who will be killed exit at the first == check.
But it lacks some real same input test.
for every tests, it lacks verse.
whenever check contentEqualsIgnoreEOF(input1,input2) be true, must make sure it contentEqualsIgnoreEOF(input2,input1) also be true.
some \r, \n, \r\n examples.
the original only have one \r\n example, but have no tests for \r and \n.
non-equal-length examples.
like "123" and "1234" be false.
they share common prefix, but a longer one is not same.
some really not equal examples.
like "1235" and "1234", they really differ on some char, and should return false.
When I run mvn site -P jacoco on git. master, this method already has 100% code coverage, so more tests are not needed IMO.
Hi.
The new added tests are for pr #118 (for both logical and coverage)
Sebb think I should not change test codes in that pr (in order not to break any test, which I agree somehow), so I have to split them out to a new pr.
So this pr SHOULD be reviewed only after #118
JaCoCo shows this method's coverage is already at 100%/100%, so this does not test anything new. Especially since all EOL handling is handled by the Reader's readLine() method, not by our method, so I say let's keep it simple and not test the JRE itself. This PR can just be closed IMO.
JaCoCo shows this method's coverage is already at 100%/100%, so this does not test anything new. Especially since all EOL handling is handled by the Reader's readLine() method, not by our method, so I say let's keep it simple and not test the JRE itself. This PR can just be closed IMO.
garydgregory
changed the title
[IO-680] add more tests for IOUtils.contentEqualsIgnoreEOL
[IO-680] Add more tests for IOUtils.contentEqualsIgnoreEOL
Apr 4, 2022
asfgit
pushed a commit
that referenced
this pull request
Apr 4, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.