aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/ex_terminal_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-01-12 13:11:28 +0000
committerLewis Russell <lewis6991@gmail.com>2024-01-12 17:53:27 +0000
commit4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e (patch)
tree0cbb2cf8dac8b4f43109dc6f7a4051dfbea23f12 /test/functional/terminal/ex_terminal_spec.lua
parentc30f2e3182e3b50e7c03932027ac55edfc8ada4a (diff)
downloadrneovim-4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e.tar.gz
rneovim-4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e.tar.bz2
rneovim-4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e.zip
test: normalise nvim bridge functions
- remove helpers.cur*meths - remove helpers.nvim
Diffstat (limited to 'test/functional/terminal/ex_terminal_spec.lua')
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua35
1 files changed, 18 insertions, 17 deletions
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua
index 68d206c177..266a34feea 100644
--- a/test/functional/terminal/ex_terminal_spec.lua
+++ b/test/functional/terminal/ex_terminal_spec.lua
@@ -1,11 +1,12 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local assert_alive = helpers.assert_alive
-local clear, poke_eventloop, nvim = helpers.clear, helpers.poke_eventloop, helpers.nvim
+local clear, poke_eventloop = helpers.clear, helpers.poke_eventloop
local testprg, source, eq = helpers.testprg, helpers.source, helpers.eq
local feed = helpers.feed
local feed_command, eval = helpers.feed_command, helpers.eval
local funcs = helpers.funcs
+local meths = helpers.meths
local retry = helpers.retry
local ok = helpers.ok
local command = helpers.command
@@ -104,30 +105,30 @@ describe(':terminal', function()
it('nvim_get_mode() in :terminal', function()
command('terminal')
- eq({ blocking = false, mode = 'nt' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
feed('i')
- eq({ blocking = false, mode = 't' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
feed([[<C-\><C-N>]])
- eq({ blocking = false, mode = 'nt' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
end)
it(':stopinsert RPC request exits terminal-mode #7807', function()
command('terminal')
feed('i[tui] insert-mode')
- eq({ blocking = false, mode = 't' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
command('stopinsert')
feed('<Ignore>') -- Add input to separate two RPC requests
- eq({ blocking = false, mode = 'nt' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
end)
it(":stopinsert in normal mode doesn't break insert mode #9889", function()
command('terminal')
- eq({ blocking = false, mode = 'nt' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
command('stopinsert')
feed('<Ignore>') -- Add input to separate two RPC requests
- eq({ blocking = false, mode = 'nt' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 'nt' }, meths.nvim_get_mode())
feed('a')
- eq({ blocking = false, mode = 't' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
end)
it('switching to terminal buffer in Insert mode goes to Terminal mode #7164', function()
@@ -138,9 +139,9 @@ describe(':terminal', function()
command('autocmd InsertLeave * let g:events += ["InsertLeave"]')
command('autocmd TermEnter * let g:events += ["TermEnter"]')
command('inoremap <F2> <Cmd>wincmd p<CR>')
- eq({ blocking = false, mode = 'i' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 'i' }, meths.nvim_get_mode())
feed('<F2>')
- eq({ blocking = false, mode = 't' }, nvim('get_mode'))
+ eq({ blocking = false, mode = 't' }, meths.nvim_get_mode())
eq({ 'InsertLeave', 'TermEnter' }, eval('g:events'))
end)
end)
@@ -158,9 +159,9 @@ local function test_terminal_with_fake_shell(backslash)
clear()
screen = Screen.new(50, 4)
screen:attach({ rgb = false })
- nvim('set_option_value', 'shell', shell_path, {})
- nvim('set_option_value', 'shellcmdflag', 'EXE', {})
- nvim('set_option_value', 'shellxquote', '', {})
+ meths.nvim_set_option_value('shell', shell_path, {})
+ meths.nvim_set_option_value('shellcmdflag', 'EXE', {})
+ meths.nvim_set_option_value('shellxquote', '', {})
end)
it('with no argument, acts like termopen()', function()
@@ -177,7 +178,7 @@ local function test_terminal_with_fake_shell(backslash)
end)
it("with no argument, and 'shell' is set to empty string", function()
- nvim('set_option_value', 'shell', '', {})
+ meths.nvim_set_option_value('shell', '', {})
feed_command('terminal')
screen:expect([[
^ |
@@ -187,7 +188,7 @@ local function test_terminal_with_fake_shell(backslash)
end)
it("with no argument, but 'shell' has arguments, acts like termopen()", function()
- nvim('set_option_value', 'shell', shell_path .. ' INTERACT', {})
+ meths.nvim_set_option_value('shell', shell_path .. ' INTERACT', {})
feed_command('terminal')
screen:expect([[
^interact $ |
@@ -208,7 +209,7 @@ local function test_terminal_with_fake_shell(backslash)
end)
it("executes a given command through the shell, when 'shell' has arguments", function()
- nvim('set_option_value', 'shell', shell_path .. ' -t jeff', {})
+ meths.nvim_set_option_value('shell', shell_path .. ' -t jeff', {})
command('set shellxquote=') -- win: avoid extra quotes
feed_command('terminal echo hi')
screen:expect([[