diff options
Diffstat (limited to 'test/functional/terminal')
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 30 | ||||
-rw-r--r-- | test/functional/terminal/cursor_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/terminal/helpers.lua | 8 | ||||
-rw-r--r-- | test/functional/terminal/highlight_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/terminal/scrollback_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 8 | ||||
-rw-r--r-- | test/functional/terminal/window_split_tab_spec.lua | 8 |
8 files changed, 53 insertions, 49 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 129390a7a5..48b8512bf0 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim local wait = helpers.wait -local eval, execute, source = helpers.eval, helpers.execute, helpers.source +local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source local eq, neq = helpers.eq, helpers.neq local write_file = helpers.write_file @@ -13,7 +13,7 @@ describe('terminal buffer', function() before_each(function() clear() - execute('set modifiable swapfile undolevels=20') + feed_command('set modifiable swapfile undolevels=20') wait() screen = thelpers.screen_setup() end) @@ -86,7 +86,7 @@ describe('terminal buffer', function() it('sends data to the terminal when the "put" operator is used', function() feed('<c-\\><c-n>gg"ayj') - execute('let @a = "appended " . @a') + feed_command('let @a = "appended " . @a') feed('"ap"ap') screen:expect([[ ^tty ready | @@ -112,8 +112,8 @@ describe('terminal buffer', function() it('sends data to the terminal when the ":put" command is used', function() feed('<c-\\><c-n>gg"ayj') - execute('let @a = "appended " . @a') - execute('put a') + feed_command('let @a = "appended " . @a') + feed_command('put a') screen:expect([[ ^tty ready | appended tty ready | @@ -124,7 +124,7 @@ describe('terminal buffer', function() :put a | ]]) -- line argument is only used to move the cursor - execute('6put a') + feed_command('6put a') screen:expect([[ tty ready | appended tty ready | @@ -147,7 +147,7 @@ describe('terminal buffer', function() {4:~ }| :bd! | ]]) - execute('bnext') + feed_command('bnext') screen:expect([[ ^ | {4:~ }| @@ -162,7 +162,7 @@ describe('terminal buffer', function() it('handles loss of focus gracefully', function() -- Change the statusline to avoid printing the file name, which varies. nvim('set_option', 'statusline', '==========') - execute('set laststatus=0') + feed_command('set laststatus=0') -- Save the buffer number of the terminal for later testing. local tbuf = eval('bufnr("%")') @@ -191,16 +191,16 @@ describe('terminal buffer', function() ]]) neq(tbuf, eval('bufnr("%")')) - execute('quit!') -- Should exit the new window, not the terminal. + feed_command('quit!') -- Should exit the new window, not the terminal. eq(tbuf, eval('bufnr("%")')) - execute('set laststatus=1') -- Restore laststatus to the default. + feed_command('set laststatus=1') -- Restore laststatus to the default. end) it('term_close() use-after-free #4393', function() - execute('terminal yes') + feed_command('terminal yes') feed([[<C-\><C-n>]]) - execute('bdelete!') + feed_command('bdelete!') end) end) @@ -217,12 +217,12 @@ describe('No heap-buffer-overflow when using', function() end) it('termopen(echo) #3161', function() - execute('edit ' .. testfilename) + feed_command('edit ' .. testfilename) -- Move cursor away from the beginning of the line feed('$') -- Let termopen() modify the buffer - execute('call termopen("echo")') + feed_command('call termopen("echo")') wait() - execute('bdelete!') + feed_command('bdelete!') end) end) diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 84f14585fa..84d0322f12 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -2,7 +2,8 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local thelpers = require('test.functional.terminal.helpers') local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim -local nvim_dir, execute = helpers.nvim_dir, helpers.execute +local nvim_dir, command = helpers.nvim_dir, helpers.command +local feed_command = helpers.feed_command local hide_cursor = thelpers.hide_cursor local show_cursor = thelpers.show_cursor @@ -138,7 +139,8 @@ describe('cursor with customized highlighting', function() [3] = {bold = true}, }) screen:attach({rgb=false}) - execute('call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') + command('call termopen(["'..nvim_dir..'/tty-test"])') + feed_command('startinsert') end) it('overrides the default highlighting', function() diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 9bb683f25f..154374cda9 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, wait, nvim = helpers.clear, helpers.wait, helpers.nvim local nvim_dir, source, eq = helpers.nvim_dir, helpers.source, helpers.eq -local execute, eval = helpers.execute, helpers.eval +local feed_command, eval = helpers.feed_command, helpers.eval if helpers.pending_win32(pending) then return end @@ -23,11 +23,11 @@ describe(':terminal', function() echomsg "msg3" ]]) -- Invoke a command that emits frequent terminal activity. - execute([[terminal while true; do echo X; done]]) + feed_command([[terminal while true; do echo X; done]]) helpers.feed([[<C-\><C-N>]]) wait() helpers.sleep(10) -- Let some terminal activity happen. - execute("messages") + feed_command("messages") screen:expect([[ msg1 | msg2 | @@ -37,14 +37,14 @@ describe(':terminal', function() end) it("in normal-mode :split does not move cursor", function() - execute([[terminal while true; do echo foo; sleep .1; done]]) + feed_command([[terminal while true; do echo foo; sleep .1; done]]) helpers.feed([[<C-\><C-N>M]]) -- move cursor away from last line wait() eq(3, eval("line('$')")) -- window height eq(2, eval("line('.')")) -- cursor is in the middle - execute('vsplit') + feed_command('vsplit') eq(2, eval("line('.')")) -- cursor stays where we put it - execute('split') + feed_command('split') eq(2, eval("line('.')")) -- cursor stays where we put it end) @@ -65,7 +65,7 @@ describe(':terminal (with fake shell)', function() -- Invokes `:terminal {cmd}` using a fake shell (shell-test.c) which prints -- the {cmd} and exits immediately . local function terminal_with_fake_shell(cmd) - execute("terminal "..(cmd and cmd or "")) + feed_command("terminal "..(cmd and cmd or "")) end it('with no argument, acts like termopen()', function() @@ -157,7 +157,7 @@ describe(':terminal (with fake shell)', function() end) it('works with findfile()', function() - execute('terminal') + feed_command('terminal') eq('term://', string.match(eval('bufname("%")'), "^term://")) eq('scripts/shadacat.py', eval('findfile("scripts/shadacat.py", ".")')) end) @@ -173,7 +173,7 @@ describe(':terminal (with fake shell)', function() ]]) eq('term://', string.match(eval('bufname("%")'), "^term://")) helpers.feed([[<C-\><C-N>]]) - execute([[find */shadacat.py]]) + feed_command([[find */shadacat.py]]) eq('scripts/shadacat.py', eval('bufname("%")')) end) diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua index 934c01e3bf..3b04d17705 100644 --- a/test/functional/terminal/helpers.lua +++ b/test/functional/terminal/helpers.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(nil) local Screen = require('test.functional.ui.screen') local nvim_dir = helpers.nvim_dir -local execute, nvim = helpers.execute, helpers.nvim +local feed_command, nvim = helpers.feed_command, helpers.nvim local function feed_data(data) nvim('set_var', 'term_data', data) @@ -58,15 +58,15 @@ local function screen_setup(extra_rows, command, cols) screen:attach({rgb=false}) - execute('enew | call termopen('..command..')') + feed_command('enew | call termopen('..command..')') nvim('input', '<CR>') local vim_errmsg = nvim('eval', 'v:errmsg') if vim_errmsg and "" ~= vim_errmsg then error(vim_errmsg) end - execute('setlocal scrollback=10') - execute('startinsert') + feed_command('setlocal scrollback=10') + feed_command('startinsert') -- tty-test puts the terminal into raw mode and echoes input. Tests work by -- feeding termcodes to control the display and asserting by screen:expect. diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 0fe463401e..bb40770235 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local thelpers = require('test.functional.terminal.helpers') local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim -local nvim_dir, execute = helpers.nvim_dir, helpers.execute +local nvim_dir, command = helpers.nvim_dir, helpers.command local eq, eval = helpers.eq, helpers.eval if helpers.pending_win32(pending) then return end @@ -27,7 +27,8 @@ describe('terminal window highlighting', function() [11] = {background = 11}, }) screen:attach({rgb=false}) - execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') + command('enew | call termopen(["'..nvim_dir..'/tty-test"])') + feed('i') screen:expect([[ tty ready | {10: } | @@ -130,7 +131,8 @@ describe('terminal window highlighting with custom palette', function() }) screen:attach({rgb=true}) nvim('set_var', 'terminal_color_3', '#123456') - execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') + command('enew | call termopen(["'..nvim_dir..'/tty-test"])') + feed('i') screen:expect([[ tty ready | {7: } | @@ -164,9 +166,9 @@ describe('synIDattr()', function() before_each(function() clear() screen = Screen.new(50, 7) - execute('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black') + command('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black') -- Salmon #fa8072 Maroon #800000 - execute('highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon') + command('highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon') end) it('returns cterm-color if RGB-capable UI is _not_ attached', function() @@ -213,8 +215,8 @@ describe('fg/bg special colors', function() before_each(function() clear() screen = Screen.new(50, 7) - execute('highlight Normal ctermfg=145 ctermbg=16 guifg=#ff0000 guibg=Black') - execute('highlight Visual ctermfg=bg ctermbg=fg guifg=bg guibg=fg guisp=bg') + command('highlight Normal ctermfg=145 ctermbg=16 guifg=#ff0000 guibg=Black') + command('highlight Visual ctermfg=bg ctermbg=fg guifg=bg guibg=fg guisp=bg') end) it('resolve to "Normal" values', function() @@ -251,7 +253,7 @@ describe('fg/bg special colors', function() screen:attach({rgb=true}) local new_guibg = '#282c34' local new_guifg = '#abb2bf' - execute('highlight Normal guifg='..new_guifg..' guibg='..new_guibg) + command('highlight Normal guifg='..new_guifg..' guibg='..new_guibg) eq(new_guibg, eval('synIDattr(hlID("Visual"), "fg#")')) eq(new_guifg, eval('synIDattr(hlID("Visual"), "bg#")')) eq(new_guibg, eval('synIDattr(hlID("Visual"), "sp#")')) diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index 4ead288a19..32f25d4086 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -2,7 +2,7 @@ local Screen = require('test.functional.ui.screen') local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') local clear, eq, curbuf = helpers.clear, helpers.eq, helpers.curbuf -local feed, nvim_dir, execute = helpers.feed, helpers.nvim_dir, helpers.execute +local feed, nvim_dir, feed_command = helpers.feed, helpers.nvim_dir, helpers.feed_command local eval = helpers.eval local command = helpers.command local wait = helpers.wait @@ -339,7 +339,7 @@ describe('terminal prints more lines than the screen height and exits', function clear() local screen = Screen.new(30, 7) screen:attach({rgb=false}) - execute('call termopen(["'..nvim_dir..'/tty-test", "10"]) | startinsert') + feed_command('call termopen(["'..nvim_dir..'/tty-test", "10"]) | startinsert') wait() screen:expect([[ line6 | @@ -451,7 +451,7 @@ describe("'scrollback' option", function() it(':setlocal in a normal buffer is an error', function() command('new') - execute('setlocal scrollback=42') + feed_command('setlocal scrollback=42') feed('<CR>') eq('E474:', string.match(eval("v:errmsg"), "E%d*:")) eq(-1, curbufmeths.get_option('scrollback')) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index e56fd2db5c..b14bceecdd 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') local feed_data = thelpers.feed_data -local execute = helpers.execute +local feed_command = helpers.feed_command local nvim_dir = helpers.nvim_dir local retry = helpers.retry @@ -60,7 +60,7 @@ describe('tui', function() it('interprets leading <Esc> byte as ALT modifier in normal-mode', function() local keys = 'dfghjkl' for c in keys:gmatch('.') do - execute('nnoremap <a-'..c..'> ialt-'..c..'<cr><esc>') + feed_command('nnoremap <a-'..c..'> ialt-'..c..'<cr><esc>') feed_data('\027'..c) end screen:expect([[ @@ -153,7 +153,7 @@ describe('tui', function() end) it('can handle arbitrarily long bursts of input', function() - execute('set ruler') + feed_command('set ruler') local t = {} for i = 1, 3000 do t[i] = 'item ' .. tostring(i) @@ -231,7 +231,7 @@ describe('tui focus event handling', function() end) it('can handle focus events in insert mode', function() - execute('set noshowmode') + feed_command('set noshowmode') feed_data('i') feed_data('\027[I') screen:expect([[ diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua index d3386a641e..4867e0d9fa 100644 --- a/test/functional/terminal/window_split_tab_spec.lua +++ b/test/functional/terminal/window_split_tab_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') local clear = helpers.clear local feed, nvim = helpers.feed, helpers.nvim -local execute = helpers.execute +local feed_command = helpers.feed_command if helpers.pending_win32(pending) then return end @@ -26,7 +26,7 @@ describe('terminal', function() it('resets its size when entering terminal window', function() feed('<c-\\><c-n>') - execute('2split') + feed_command('2split') screen:expect([[ rows: 2, cols: 50 | {2:^ } | @@ -39,7 +39,7 @@ describe('terminal', function() ========== | :2split | ]]) - execute('wincmd p') + feed_command('wincmd p') screen:expect([[ tty ready | rows: 2, cols: 50 | @@ -52,7 +52,7 @@ describe('terminal', function() ========== | :wincmd p | ]]) - execute('wincmd p') + feed_command('wincmd p') screen:expect([[ rows: 2, cols: 50 | {2:^ } | |