rename Range.from_txtobj => from_motion
Some checks failed
NeoVim tests / plenary-tests (push) Failing after 7s

This commit is contained in:
2025-04-11 21:37:28 -06:00
parent 0ee6caa7ba
commit 87930bf3af
7 changed files with 33 additions and 33 deletions

View File

@@ -187,53 +187,53 @@ describe('Range', function()
it('text object: word', function()
withbuf({ 'the quick brown fox' }, function()
vim.fn.setpos('.', { 0, 1, 5, 0 })
assert.are.same('quick ', Range.from_txtobj('aw'):text())
assert.are.same('quick ', Range.from_motion('aw'):text())
vim.fn.setpos('.', { 0, 1, 5, 0 })
assert.are.same('quick', Range.from_txtobj('iw'):text())
assert.are.same('quick', Range.from_motion('iw'):text())
end)
end)
it('text object: quote', function()
withbuf({ [[the "quick" brown fox]] }, function()
vim.fn.setpos('.', { 0, 1, 5, 0 })
assert.are.same('"quick"', Range.from_txtobj('a"'):text())
assert.are.same('"quick"', Range.from_motion('a"'):text())
vim.fn.setpos('.', { 0, 1, 6, 0 })
assert.are.same('quick', Range.from_txtobj('i"'):text())
assert.are.same('quick', Range.from_motion('i"'):text())
end)
withbuf({ [[the 'quick' brown fox]] }, function()
vim.fn.setpos('.', { 0, 1, 5, 0 })
assert.are.same("'quick'", Range.from_txtobj([[a']]):text())
assert.are.same("'quick'", Range.from_motion([[a']]):text())
vim.fn.setpos('.', { 0, 1, 6, 0 })
assert.are.same('quick', Range.from_txtobj([[i']]):text())
assert.are.same('quick', Range.from_motion([[i']]):text())
end)
withbuf({ [[the `quick` brown fox]] }, function()
vim.fn.setpos('.', { 0, 1, 5, 0 })
assert.are.same('`quick`', Range.from_txtobj([[a`]]):text())
assert.are.same('`quick`', Range.from_motion([[a`]]):text())
vim.fn.setpos('.', { 0, 1, 6, 0 })
assert.are.same('quick', Range.from_txtobj([[i`]]):text())
assert.are.same('quick', Range.from_motion([[i`]]):text())
end)
end)
it('text object: block', function()
withbuf({ 'this is a {', 'block', '} here' }, function()
vim.fn.setpos('.', { 0, 2, 1, 0 })
assert.are.same('{\nblock\n}', Range.from_txtobj('a{'):text())
assert.are.same('{\nblock\n}', Range.from_motion('a{'):text())
vim.fn.setpos('.', { 0, 2, 1, 0 })
assert.are.same('block', Range.from_txtobj('i{'):text())
assert.are.same('block', Range.from_motion('i{'):text())
end)
end)
it('text object: restores cursor position', function()
withbuf({ 'this is a {block} here' }, function()
vim.fn.setpos('.', { 0, 1, 13, 0 })
assert.are.same('{block}', Range.from_txtobj('a{'):text())
assert.are.same('{block}', Range.from_motion('a{'):text())
assert.are.same(vim.api.nvim_win_get_cursor(0), { 1, 12 })
end)
end)