-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add editor pattern test in BracketedPatternTest #9946
Conversation
Thank you very much! Please go ahead and fix this as well :) |
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.
Overall this looks very good, and I love the detailed description! I am slightly disturbed that the authNofMth
error seems to have been here since 2017, so test cases for this are definitively needed 😱
Remaining
- I am not sure about one of the test cases. Could you write down your thoughts regarding it, or if we have a similar test case in a different part of the code, reference it? I am hesitant to include it because I believe it might be a misuse of the editors' field, in which case all bets are off, and there isn't a right or wrong behavior of JabRef
- Would you mind fixing the code style check complaints? It is much less important in a test case, but since it is only complaining about new lines
- Since the behavior is changing, please add an entry to the change list, even if it is now the correct behavior as described in the documentation
src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java
Outdated
Show resolved
Hide resolved
@chiao26168 can you please add a changelog entry? |
Should I add two entries, one for adding the test case and the other for fixing the error? |
Changelog is intended for the end users so just one for the changed behavior/fix |
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.
LGTM! We greatly appreciate the detailed description, the missing test-cases, detection of a bug, and fixing of the bug 😅
Co-authored-by: Jonatan Asketorp <[email protected]>
Thanks again for the tests and finding these bugs! |
Compulsory checks
The existing test class, org.jabref.logic.citationkeypattern.BracketedPatternTest.java, currently lacks coverage for editor patterns. To address this gap, I have added a new test method, testEditorFieldMarkers() to ensure that the editor pattern functions correctly.
During the execution of testEditorFieldMarkers(), one test case failed. The input provided was "'New', '[edtr3_1]', 'Isaac Newton'", and the expected output was 'New'. However, the actual output was null.
(output of the failed test case)
The source of the error can be found in org.jabref.logic.citationkeypattern.BracketedPattern.
As stated in Customize the citation key generator, when the pattern matches "edtrN_M", the citation key should consist of the first N characters of the Mth editor's last name.
Here is a screenshot highlighting the problem in the source code:
To fix this issue, the following return statement should be used