-
Notifications
You must be signed in to change notification settings - Fork 707
Improve commit line unwrapping #8335
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 all commits
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -222,4 +222,12 @@ describe('titleAndBodyFrom', function () { | |||||
| assert.strictEqual(result?.title, 'title'); | ||||||
| assert.strictEqual(result?.body, 'Wrapped paragraph across lines.\n\n- Item 1\n - Nested item\n More nested content\n- Item 2\n\nAnother wrapped paragraph here.'); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: I think the nested lines should be merged.
Suggested change
|
||||||
| }); | ||||||
|
|
||||||
| it('handles nested lists', async function () { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alexr00 Sorry, I wasn't quick enough to review this PR before merging, but I'd suggest adding a few more test cases, including some using numbered list items which are harder to implement than unordered lists because the numeric part can be variable-length. Also, the number of spaces is actually quite lenient in GitHub. Finally, code blocks and additional paragraphs are also supported in GH lists, so should probably have test cases for those. I didn't review this PR code closely, but I did see a few Here's some test cases, adapted from https://chatgpt.com/share/695c1f08-b928-8004-88c1-79417405b729. All the cases above should have their lines joined where there's a single I suspect it'd be good to also make nested versions of these tests... I'll leave that as an exercise for copilot! :-)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the test cases! |
||||||
| const message = Promise.resolve('title\n\n* This is a list item with two lines\n that have a line break between them\n * This is a nested list item that also has\n two lines that should have been merged'); | ||||||
|
|
||||||
| const result = await titleAndBodyFrom(message); | ||||||
| assert.strictEqual(result?.title, 'title'); | ||||||
| assert.strictEqual(result?.body, '* This is a list item with two lines that have a line break between them\n * This is a nested list item that also has two lines that should have been merged'); | ||||||
| }); | ||||||
| }); | ||||||
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.
nit: it's a little inconsistent that some regex-es are tested as "variable.test(...)" and some are wrapped into local functions.