-
Notifications
You must be signed in to change notification settings - Fork 18
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
👍 remove unnecessary 'foldmethod' changes #271
Changes from 1 commit
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 |
---|---|---|
|
@@ -302,6 +302,69 @@ test({ | |
assertEquals(0, await fn.getbufvar(denops, bufnr, "&modifiable")); | ||
}, | ||
}); | ||
await t.step({ | ||
name: "appends content of a 'foldmethod=marker' buffer", | ||
fn: async () => { | ||
await denops.cmd("enew"); | ||
const bufnr = await fn.bufnr(denops); | ||
await fn.setbufvar(denops, bufnr, "&foldmethod", "marker"); | ||
await fn.setbufvar(denops, bufnr, "&foldmarker", "{{{,}}}"); | ||
await append(denops, bufnr, [ | ||
"Hello {{{", | ||
"Darkness", | ||
"My }}}", | ||
"Old friend", | ||
]); | ||
assertEquals([ | ||
"", | ||
"Hello {{{", | ||
"Darkness", | ||
"My }}}", | ||
"Old friend", | ||
], await fn.getline(denops, 1, "$")); | ||
assertEquals( | ||
await fn.getbufvar(denops, bufnr, "&foldmethod"), | ||
"marker", | ||
); | ||
|
||
await fn.setbufvar(denops, bufnr, "&foldlevel", 0); | ||
await append(denops, bufnr, [ | ||
"Joking", | ||
]); | ||
assertEquals([ | ||
"", | ||
"Joking", | ||
"Hello {{{", | ||
"Darkness", | ||
"My }}}", | ||
"Old friend", | ||
], await fn.getline(denops, 1, "$")); | ||
assertEquals( | ||
await fn.getbufvar(denops, bufnr, "&foldmethod"), | ||
"marker", | ||
); | ||
|
||
await fn.setbufvar(denops, bufnr, "&foldlevel", 0); | ||
await append(denops, bufnr, [ | ||
"Foo", | ||
], { | ||
lnum: 3, | ||
}); | ||
assertEquals([ | ||
"", | ||
"Joking", | ||
"Hello {{{", | ||
"Foo", | ||
"Darkness", | ||
"My }}}", | ||
"Old friend", | ||
], await fn.getline(denops, 1, "$")); | ||
assertEquals( | ||
await fn.getbufvar(denops, bufnr, "&foldmethod"), | ||
"marker", | ||
); | ||
}, | ||
}); | ||
}, | ||
}); | ||
|
||
|
@@ -361,6 +424,42 @@ test({ | |
assertEquals(0, await fn.getbufvar(denops, bufnr, "&modifiable")); | ||
}, | ||
}); | ||
await t.step({ | ||
name: "replaces content of an 'foldmethod=marker' buffer", | ||
fn: async () => { | ||
const bufnr = await fn.bufnr(denops); | ||
await fn.setbufvar(denops, bufnr, "&foldmethod", "marker"); | ||
await fn.setbufvar(denops, bufnr, "&foldmarker", "{{{,}}}"); | ||
await replace(denops, bufnr, [ | ||
"Hello {{{", | ||
"Darkness", | ||
"My }}}", | ||
"Old friend", | ||
]); | ||
assertEquals([ | ||
"Hello {{{", | ||
"Darkness", | ||
"My }}}", | ||
"Old friend", | ||
], await fn.getline(denops, 1, "$")); | ||
assertEquals( | ||
await fn.getbufvar(denops, bufnr, "&foldmethod"), | ||
"marker", | ||
); | ||
|
||
await fn.setbufvar(denops, bufnr, "&foldlevel", 0); | ||
await replace(denops, bufnr, [ | ||
"Joking {{{1", | ||
]); | ||
assertEquals([ | ||
"Joking {{{1", | ||
], await fn.getline(denops, 1, "$")); | ||
assertEquals( | ||
await fn.getbufvar(denops, bufnr, "&foldmethod"), | ||
"marker", | ||
); | ||
}, | ||
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. Review: New test case for replacing content with 'foldmethod=marker' This test case follows a similar structure to the appending test case, focusing on replacing content in a buffer with the Like the previous test case, it would be beneficial to include checks for the actual folding behavior to ensure that the folding functionality is correctly preserved post-operation. Would you like assistance in adding checks to verify the actual folding behavior after content replacement in the buffer? |
||
}); | ||
}, | ||
}); | ||
|
||
|
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.
Review: New test case for appending content with 'foldmethod=marker'
This test case is well-structured and covers the functionality of appending content to a buffer with the
foldmethod
set to "marker". It checks both the content of the buffer and the state of thefoldmethod
after operations, which aligns with the PR's objective to ensure functionality remains intact after removing unnecessaryfoldmethod
changes.However, the test could be enhanced by verifying the actual folding behavior in the buffer, not just the
foldmethod
setting. This would ensure that the folding functionality itself is not affected by the changes.Would you like me to help add assertions to verify the actual folding behavior within the buffer?