You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/08/05 13:31:34 UTC

[GitHub] [commons-io] XenoAmess commented on pull request #137: [IO-680] add more tests for IOUtils.contentEqualsIgnoreEOL

XenoAmess commented on pull request #137:
URL: https://github.com/apache/commons-io/pull/137#issuecomment-669194030


   @sebbASF 
   > 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:
   
   1. "" and "\n"
   because "" is very tricky, and it is hard to say it for sure whether we think them equal.
   
   2. "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.
   
   3. 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.
   
   4. for every tests, it lacks verse.
   whenever check `contentEqualsIgnoreEOF(input1,input2)` be true, must make sure it `contentEqualsIgnoreEOF(input2,input1)` also be true.
   
   5. some \r, \n, \r\n examples.
   the original only have one \r\n example, but have no tests for \r and \n.
   
   6. non-equal-length examples.
   like "123" and "1234" be false.
   they share common prefix, but a longer one is not same.
   
   7. some really not equal examples.
   like "1235" and "1234", they really differ on some char, and should return false.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org