mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths
|
||||
local insert, execute = helpers.insert, helpers.execute
|
||||
local insert, feed_command = helpers.insert, helpers.feed_command
|
||||
local eq, funcs = helpers.eq, helpers.funcs
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
@@ -123,9 +123,9 @@ describe('ui/mouse/input', function()
|
||||
end)
|
||||
|
||||
it('in tabline on filler space moves tab to the end', function()
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -160,9 +160,9 @@ describe('ui/mouse/input', function()
|
||||
return
|
||||
end
|
||||
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -190,9 +190,9 @@ describe('ui/mouse/input', function()
|
||||
end)
|
||||
|
||||
it('in tabline to the right moves tab right', function()
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -220,9 +220,9 @@ describe('ui/mouse/input', function()
|
||||
end)
|
||||
|
||||
it('out of tabline under filler space moves tab to the end', function()
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -265,9 +265,9 @@ describe('ui/mouse/input', function()
|
||||
return
|
||||
end
|
||||
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -303,9 +303,9 @@ describe('ui/mouse/input', function()
|
||||
end)
|
||||
|
||||
it('out of tabline to the right moves tab right', function()
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -352,9 +352,9 @@ describe('ui/mouse/input', function()
|
||||
end)
|
||||
|
||||
it('left click in default tabline (position 4) switches to tab', function()
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -375,9 +375,9 @@ describe('ui/mouse/input', function()
|
||||
|
||||
it('left click in default tabline (position 24) closes tab', function()
|
||||
meths.set_option('hidden', true)
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -398,9 +398,9 @@ describe('ui/mouse/input', function()
|
||||
|
||||
it('double click in default tabline (position 4) opens new tab', function()
|
||||
meths.set_option('hidden', true)
|
||||
execute('%delete')
|
||||
feed_command('%delete')
|
||||
insert('this is foo')
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
screen:expect([[
|
||||
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
|
||||
@@ -421,13 +421,13 @@ describe('ui/mouse/input', function()
|
||||
|
||||
describe('%@ label', function()
|
||||
before_each(function()
|
||||
execute([[
|
||||
feed_command([[
|
||||
function Test(...)
|
||||
let g:reply = a:000
|
||||
return copy(a:000) " Check for memory leaks: return should be freed
|
||||
endfunction
|
||||
]])
|
||||
execute([[
|
||||
feed_command([[
|
||||
function Test2(...)
|
||||
return call('Test', a:000 + [2])
|
||||
endfunction
|
||||
@@ -533,9 +533,9 @@ describe('ui/mouse/input', function()
|
||||
fill = { reverse=true },
|
||||
vis = { background=Screen.colors.LightGrey }
|
||||
})
|
||||
execute('silent file foo | tabnew | file bar')
|
||||
feed_command('silent file foo | tabnew | file bar')
|
||||
insert('this is bar')
|
||||
execute('tabprevious') -- go to first tab
|
||||
feed_command('tabprevious') -- go to first tab
|
||||
screen:expect([[
|
||||
{sel: + foo }{tab: + bar }{fill: }{tab:X}|
|
||||
mouse |
|
||||
@@ -641,7 +641,7 @@ describe('ui/mouse/input', function()
|
||||
mouse scrolling
|
||||
]])
|
||||
screen:try_resize(53, 14)
|
||||
execute('sp', 'vsp')
|
||||
feed_command('sp', 'vsp')
|
||||
screen:expect([[
|
||||
lines {4:|}lines |
|
||||
to {4:|}to |
|
||||
@@ -754,12 +754,12 @@ describe('ui/mouse/input', function()
|
||||
})
|
||||
feed('ggdG')
|
||||
|
||||
execute('set concealcursor=n')
|
||||
execute('set nowrap')
|
||||
execute('syntax match NonText "\\<amet\\>" conceal')
|
||||
execute('syntax match NonText "\\cs\\|g." conceal cchar=X')
|
||||
execute('syntax match NonText "\\%(lo\\|cl\\)." conceal')
|
||||
execute('syntax match NonText "Lo" conceal cchar=Y')
|
||||
feed_command('set concealcursor=n')
|
||||
feed_command('set nowrap')
|
||||
feed_command('syntax match NonText "\\<amet\\>" conceal')
|
||||
feed_command('syntax match NonText "\\cs\\|g." conceal cchar=X')
|
||||
feed_command('syntax match NonText "\\%(lo\\|cl\\)." conceal')
|
||||
feed_command('syntax match NonText "Lo" conceal cchar=Y')
|
||||
|
||||
insert([[
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr.
|
||||
@@ -770,7 +770,7 @@ describe('ui/mouse/input', function()
|
||||
end)
|
||||
|
||||
it('(level 1) click on non-wrapped lines', function()
|
||||
execute('let &conceallevel=1', 'echo')
|
||||
feed_command('let &conceallevel=1', 'echo')
|
||||
|
||||
feed('<esc><LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
@@ -818,7 +818,7 @@ describe('ui/mouse/input', function()
|
||||
end) -- level 1 - non wrapped
|
||||
|
||||
it('(level 1) click on wrapped lines', function()
|
||||
execute('let &conceallevel=1', 'let &wrap=1', 'echo')
|
||||
feed_command('let &conceallevel=1', 'let &wrap=1', 'echo')
|
||||
|
||||
feed('<esc><LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
@@ -867,7 +867,7 @@ describe('ui/mouse/input', function()
|
||||
|
||||
|
||||
it('(level 2) click on non-wrapped lines', function()
|
||||
execute('let &conceallevel=2', 'echo')
|
||||
feed_command('let &conceallevel=2', 'echo')
|
||||
|
||||
feed('<esc><LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
@@ -915,7 +915,7 @@ describe('ui/mouse/input', function()
|
||||
end) -- level 2 - non wrapped
|
||||
|
||||
it('(level 2) click on wrapped lines', function()
|
||||
execute('let &conceallevel=2', 'let &wrap=1', 'echo')
|
||||
feed_command('let &conceallevel=2', 'let &wrap=1', 'echo')
|
||||
|
||||
feed('<esc><LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
@@ -964,7 +964,7 @@ describe('ui/mouse/input', function()
|
||||
|
||||
|
||||
it('(level 3) click on non-wrapped lines', function()
|
||||
execute('let &conceallevel=3', 'echo')
|
||||
feed_command('let &conceallevel=3', 'echo')
|
||||
|
||||
feed('<esc><LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
@@ -1012,7 +1012,7 @@ describe('ui/mouse/input', function()
|
||||
end) -- level 3 - non wrapped
|
||||
|
||||
it('(level 3) click on wrapped lines', function()
|
||||
execute('let &conceallevel=3', 'let &wrap=1', 'echo')
|
||||
feed_command('let &conceallevel=3', 'let &wrap=1', 'echo')
|
||||
|
||||
feed('<esc><LeftMouse><0,0>')
|
||||
screen:expect([[
|
||||
|
||||
Reference in New Issue
Block a user