-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add #12810: Implement escaping for keyword separators (FKA #12888) #13583
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
Changes from 5 commits
7b5505c
44257ad
e6c52dd
d2ad73d
465955a
4928536
2ccc24e
1111794
83198c0
cc5fa8b
87d1ff6
3d2785b
1b455d3
2b85d0c
4b31cd0
d15f2ef
d77bb5e
02c252d
027dde0
ea690d6
b6f728f
a72b614
4c5181b
b02aeea
eef54b6
ffeb78d
1f321c2
3e2636f
634d302
b2d902f
42710fa
4b2a8d8
a2031ed
af3c50e
e955fd1
a3d69f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,4 +115,41 @@ void mergeTwoDistinctKeywordsShouldReturnTheTwoKeywordsMerged() { | |
| void mergeTwoListsOfKeywordsShouldReturnTheKeywordsMerged() { | ||
| assertEquals(new KeywordList("Figma", "Adobe", "JabRef", "Eclipse", "JetBrains"), KeywordList.merge("Figma, Adobe, JetBrains, Eclipse", "Adobe, JabRef", ',')); | ||
| } | ||
|
|
||
| @Test | ||
| void parseKeywordWithEscapedDelimiterDoesNotSplitKeyword() { | ||
|
||
| assertEquals(new KeywordList("keyword,one", "keywordTwo"), | ||
| KeywordList.parse("keyword\\,one, keywordTwo", ',', '>')); | ||
| } | ||
|
|
||
| @Test | ||
| void parseKeywordWithEscapedDelimiterAtEndPreservesDelimiter() { | ||
| assertEquals(new KeywordList("keywordOne,", "keywordTwo"), | ||
| KeywordList.parse("keywordOne\\,, keywordTwo", ',', '>')); | ||
| } | ||
|
|
||
| @Test | ||
| void parseKeywordWithEscapedBackslashTreatsItAsLiteral() { | ||
| assertEquals(new KeywordList("keyword\\", "keywordTwo"), | ||
| KeywordList.parse("keyword\\\\, keywordTwo", ',', '>')); | ||
| } | ||
|
|
||
| @Test | ||
| void parseKeywordWithEscapedDelimiterAndHierarchicalDelimiterCreatesHierarchy() { | ||
| Keyword expected = Keyword.of("keyword,one", "sub"); | ||
| assertEquals(new KeywordList(expected), | ||
| KeywordList.parse("keyword\\,one > sub", ',', '>')); | ||
| } | ||
|
|
||
| @Test | ||
| void parseKeywordWithMultipleEscapedDelimitersTreatsThemAsLiteral() { | ||
| assertEquals(new KeywordList("one,two,three", "four"), | ||
| KeywordList.parse("one\\,two\\,three, four", ',', '>')); | ||
| } | ||
|
|
||
| @Test | ||
| void parseKeywordWithTrailingEscapeCharacterTreatsItAsLiteralBackslash() { | ||
| assertEquals(new KeywordList("keywordOne\\"), | ||
| KeywordList.parse("keywordOne\\\\", ',', '>')); | ||
| } | ||
| } | ||
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.
Note this is #12888 (comment) :)
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.
Thanks for your review! As I dived into the project I saw that this loop had not been addressed. So I used @ungerts proposed comment, since it is readable and solves the issue. Am I missing something?
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.
This is very OK. I like links to provide context.
Other reviewers might think: why a for loop etc.
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.
Ooh ok perfect :)