Conversation
Review Summary by QodoFix Windows test failure with unified line breaks
WalkthroughsDescription• Replace OS-specific newline constant with unified line break handling • Use StringUtil.unifyLineBreaks() for cross-platform test compatibility • Fix Windows test failure in RelatedWorkInserterTest Diagramflowchart LR
A["OS.NEWLINE constant"] -- "replace with" --> B["StringUtil.unifyLineBreaks()"]
B -- "ensures" --> C["Cross-platform compatibility"]
C -- "fixes" --> D["Windows test failure"]
File Changes1. jablib/src/test/java/org/jabref/logic/relatedwork/RelatedWorkInserterTest.java
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
|
|
||
| assertInstanceOf(RelatedWorkInsertionResult.Inserted.class, insertionResults.getFirst()); | ||
| assertEquals("[test]: blahblah" + OS.NEWLINE + OS.NEWLINE + "[LunaOstos_2024]: Colombia is a middle-income country with a population of approximately 50 million.", | ||
| assertEquals(StringUtil.unifyLineBreaks("[test]: blahblah".stripTrailing(), "\n") + "\n\n" + "[LunaOstos_2024]: Colombia is a middle-income country with a population of approximately 50 million.", |
There was a problem hiding this comment.
Not sure why double (!) changes
- Use
\ninstead ofOS.NEWLINE - Unify linebreaks at tests
I think, the first one is enough to do.
If BOTH is needed, there should be a comment
There was a problem hiding this comment.
I think the confusion arises from a prior discussion #15316 (comment)
There was a problem hiding this comment.
Yes. In #15316 (comment), my thought is that we should first normalize the linebreak at the end of the sentence, before adding new linebreaks, so I use unifyLineBreaks.
In this test, I think we don't need unifyLineBreaks because the sentences contain no linebreaks. But I am not sure if we should also remove unifyLineBreaks in RelatedWorkInserter.
|
Move fast, break things, and fix them later. |
false alarm |
|
We don't normalize in tests, hence the commit 1337303 Edit (for addition to original context) - it might be the case that JavaFX normalizes to |
|
Sorry for being inactive, just finished the last exam. Should I make a follow-up PR to fix problems in #15538 (comment)? |
@pluto-han I think the above^ justifies this PR as the fix? Do you have anything else in mind? |
Yep I think then we can keep this code. |
Related issues and pull requests
Closes #15537
PR Description
Add linebreak unifier to method in
RelatedWorkInserterTest.Steps to test
On Windows, run test
insertMatchedRelatedWorkAppendsToExistingUserSpecificCommentFieldinRelatedWorkInserterTest, it should pass now.Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)