2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2016-02-03 05:52:43 -07:00
|
|
|
local call = helpers.call
|
|
|
|
local clear = helpers.clear
|
2017-04-08 14:12:26 -07:00
|
|
|
local command = helpers.command
|
2016-02-03 05:52:43 -07:00
|
|
|
local expect = helpers.expect
|
|
|
|
local source = helpers.source
|
|
|
|
|
|
|
|
describe('Text object', function()
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set shada=')
|
2016-02-03 05:52:43 -07:00
|
|
|
source([[
|
|
|
|
function SelectionOut(data)
|
|
|
|
new
|
|
|
|
call setline(1, a:data)
|
|
|
|
call setreg('"', '')
|
|
|
|
normal! ggfrmavi)y
|
|
|
|
$put =getreg('\"')
|
|
|
|
call setreg('"', '')
|
|
|
|
normal! `afbmavi)y
|
|
|
|
$put =getreg('\"')
|
|
|
|
call setreg('"', '')
|
|
|
|
normal! `afgmavi)y
|
|
|
|
$put =getreg('\"')
|
|
|
|
endfunction
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('Test for vi) without cpo-M', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set cpo-=M')
|
2016-02-03 05:52:43 -07:00
|
|
|
call('SelectionOut', '(red \\(blue) green)')
|
|
|
|
|
|
|
|
expect([[
|
|
|
|
(red \(blue) green)
|
|
|
|
red \(blue
|
|
|
|
red \(blue
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('Test for vi) with cpo-M #1', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set cpo+=M')
|
2016-02-03 05:52:43 -07:00
|
|
|
call('SelectionOut', '(red \\(blue) green)')
|
|
|
|
|
|
|
|
expect([[
|
|
|
|
(red \(blue) green)
|
|
|
|
red \(blue) green
|
|
|
|
blue
|
|
|
|
red \(blue) green]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('Test for vi) with cpo-M #2', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('set cpo+=M')
|
2016-02-03 05:52:43 -07:00
|
|
|
call('SelectionOut', '(red (blue\\) green)')
|
|
|
|
|
|
|
|
expect([[
|
|
|
|
(red (blue\) green)
|
|
|
|
red (blue\) green
|
|
|
|
blue\
|
|
|
|
red (blue\) green]])
|
|
|
|
end)
|
|
|
|
end)
|