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 spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
|
||||
local feed, execute = helpers.feed, helpers.execute
|
||||
local feed, command = helpers.feed, helpers.command
|
||||
local insert = helpers.insert
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
@@ -75,7 +75,7 @@ describe('Screen', function()
|
||||
local function check()
|
||||
eq(true, screen.suspended)
|
||||
end
|
||||
execute('suspend')
|
||||
command('suspend')
|
||||
screen:expect(check)
|
||||
screen.suspended = false
|
||||
feed('<c-z>')
|
||||
@@ -91,7 +91,7 @@ describe('Screen', function()
|
||||
eq(false, screen.visual_bell)
|
||||
end)
|
||||
screen.bell = false
|
||||
execute('set visualbell')
|
||||
command('set visualbell')
|
||||
feed('<left>')
|
||||
screen:expect(function()
|
||||
eq(true, screen.visual_bell)
|
||||
@@ -103,8 +103,8 @@ describe('Screen', function()
|
||||
describe(':set title', function()
|
||||
it('is forwarded to the UI', function()
|
||||
local expected = 'test-title'
|
||||
execute('set titlestring='..expected)
|
||||
execute('set title')
|
||||
command('set titlestring='..expected)
|
||||
command('set title')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.title)
|
||||
end)
|
||||
@@ -112,7 +112,7 @@ describe('Screen', function()
|
||||
|
||||
it('has correct default title with unnamed file', function()
|
||||
local expected = '[No Name] - NVIM'
|
||||
execute('set title')
|
||||
command('set title')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.title)
|
||||
end)
|
||||
@@ -120,8 +120,8 @@ describe('Screen', function()
|
||||
|
||||
it('has correct default title with named file', function()
|
||||
local expected = 'myfile (/mydir) - NVIM'
|
||||
execute('set title')
|
||||
execute('file /mydir/myfile')
|
||||
command('set title')
|
||||
command('file /mydir/myfile')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.title)
|
||||
end)
|
||||
@@ -131,8 +131,8 @@ describe('Screen', function()
|
||||
describe(':set icon', function()
|
||||
it('is forwarded to the UI', function()
|
||||
local expected = 'test-icon'
|
||||
execute('set iconstring='..expected)
|
||||
execute('set icon')
|
||||
command('set iconstring='..expected)
|
||||
command('set icon')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.icon)
|
||||
end)
|
||||
@@ -142,7 +142,7 @@ describe('Screen', function()
|
||||
describe('window', function()
|
||||
describe('split', function()
|
||||
it('horizontal', function()
|
||||
execute('sp')
|
||||
command('sp')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
@@ -162,8 +162,8 @@ describe('Screen', function()
|
||||
end)
|
||||
|
||||
it('horizontal and resize', function()
|
||||
execute('sp')
|
||||
execute('resize 8')
|
||||
command('sp')
|
||||
command('resize 8')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
@@ -183,7 +183,9 @@ describe('Screen', function()
|
||||
end)
|
||||
|
||||
it('horizontal and vertical', function()
|
||||
execute('sp', 'vsp', 'vsp')
|
||||
command('sp')
|
||||
command('vsp')
|
||||
command('vsp')
|
||||
screen:expect([[
|
||||
^ {3:|} {3:|} |
|
||||
{0:~ }{3:|}{0:~ }{3:|}{0:~ }|
|
||||
@@ -223,7 +225,9 @@ describe('Screen', function()
|
||||
|
||||
describe('tabnew', function()
|
||||
it('creates a new buffer', function()
|
||||
execute('sp', 'vsp', 'vsp')
|
||||
command('sp')
|
||||
command('vsp')
|
||||
command('vsp')
|
||||
insert('hello')
|
||||
screen:expect([[
|
||||
hell^o {3:|}hello {3:|}hello |
|
||||
@@ -241,7 +245,7 @@ describe('Screen', function()
|
||||
{3:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
execute('tabnew')
|
||||
command('tabnew')
|
||||
insert('hello2')
|
||||
feed('h')
|
||||
screen:expect([[
|
||||
@@ -260,7 +264,7 @@ describe('Screen', function()
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
execute('tabprevious')
|
||||
command('tabprevious')
|
||||
screen:expect([[
|
||||
{2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
|
||||
hell^o {3:|}hello {3:|}hello |
|
||||
@@ -305,9 +309,9 @@ describe('Screen', function()
|
||||
describe('normal mode', function()
|
||||
-- https://code.google.com/p/vim/issues/detail?id=339
|
||||
it("setting 'ruler' doesn't reset the preferred column", function()
|
||||
execute('set virtualedit=')
|
||||
command('set virtualedit=')
|
||||
feed('i0123456<cr>789<esc>kllj')
|
||||
execute('set ruler')
|
||||
command('set ruler')
|
||||
feed('k')
|
||||
screen:expect([[
|
||||
0123^456 |
|
||||
@@ -388,7 +392,9 @@ describe('Screen', function()
|
||||
split
|
||||
windows
|
||||
]])
|
||||
execute('sp', 'vsp', 'vsp')
|
||||
command('sp')
|
||||
command('vsp')
|
||||
command('vsp')
|
||||
screen:expect([[
|
||||
and {3:|}and {3:|}and |
|
||||
clearing {3:|}clearing {3:|}clearing |
|
||||
|
||||
Reference in New Issue
Block a user