rename Range.from_txtobj => from_motion
Some checks failed
NeoVim tests / plenary-tests (push) Failing after 7s
Some checks failed
NeoVim tests / plenary-tests (push) Failing after 7s
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user