bugfixes; update README.md

This commit is contained in:
2024-09-06 13:10:37 -06:00
parent 61460f0180
commit b9edc4d8ff
10 changed files with 366 additions and 58 deletions

View File

@@ -4,10 +4,27 @@ local withbuf = require '__tt_test_tools'
describe('Buffer', function()
it('should replace all lines', function()
withbuf({}, function()
local buf = Buffer.new()
local buf = Buffer.from_nr()
buf:all():replace 'bleh'
local actual_lines = vim.api.nvim_buf_get_lines(buf.buf, 0, -1, false)
assert.are.same({ 'bleh' }, actual_lines)
end)
end)
it('should replace all but first and last lines', function()
withbuf({
'one',
'two',
'three',
}, function()
local buf = Buffer.from_nr()
buf:lines(1, -2):replace 'too'
local actual_lines = vim.api.nvim_buf_get_lines(buf.buf, 0, -1, false)
assert.are.same({
'one',
'too',
'three',
}, actual_lines)
end)
end)
end)