-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the infoview containing a trailing newline in one case.
It was when interactive diagnostics are present. This is the main functional change of this commit -- but as part of it, the behavior of dedent as well as assert.contents and friends from the testing helpers have all changed to be what (to me) is more logical. This is the case even though there's still one "magic" behavior (in a new helper function _expected) which seems required to get a test in the abbreviations spec to pass. Also added here therefore are a bunch of tests for the testing helpers (and for dedent) which all pass and should help ensure that all this delicate code continues to work if it needs tweaking again. A secondary tweak to the testing helpers is that assert.contents and friends now automatically dedent their expected value, which makes the tests a bit more prettily indented. All the tests are then also refactored to use that "uniform" style for asserting against their contents, which is most of the whitespace change noise.
- Loading branch information
Showing
14 changed files
with
265 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
---@brief [[ | ||
--- Tests for our own testing helpers. | ||
---@brief ]] | ||
|
||
local helpers = require('tests.helpers') | ||
|
||
describe('clean_buffer <-> assert.contents', function() | ||
it('creates single line buffers', helpers.clean_buffer('foo bar', function() | ||
assert.are.same( | ||
vim.api.nvim_buf_get_lines(0, 0, -1, false), { 'foo bar' } | ||
) | ||
assert.contents.are('foo bar') | ||
end)) | ||
|
||
it('creates multiline buffers', helpers.clean_buffer([[ | ||
foo | ||
bar | ||
]], function() | ||
assert.are.same( | ||
vim.api.nvim_buf_get_lines(0, 0, -1, false), { 'foo', 'bar' } | ||
) | ||
assert.contents.are[[ | ||
foo | ||
bar | ||
]] | ||
end)) | ||
|
||
it('detects actual intended trailing newlines', helpers.clean_buffer('foo\n\n', function() | ||
assert.are.same( | ||
vim.api.nvim_buf_get_lines(0, 0, -1, false), { 'foo', '' } | ||
) | ||
assert.contents.are('foo\n') | ||
end)) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.