aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/api')
-rw-r--r--test/functional/api/autocmd_spec.lua13
-rw-r--r--test/functional/api/buffer_spec.lua30
-rw-r--r--test/functional/api/buffer_updates_spec.lua24
-rw-r--r--test/functional/api/command_spec.lua19
-rw-r--r--test/functional/api/extmark_spec.lua21
-rw-r--r--test/functional/api/highlight_spec.lua18
-rw-r--r--test/functional/api/keymap_spec.lua31
-rw-r--r--test/functional/api/menu_spec.lua8
-rw-r--r--test/functional/api/proc_spec.lua11
-rw-r--r--test/functional/api/server_notifications_spec.lua14
-rw-r--r--test/functional/api/server_requests_spec.lua39
-rw-r--r--test/functional/api/tabpage_spec.lua18
-rw-r--r--test/functional/api/ui_spec.lua18
-rw-r--r--test/functional/api/version_spec.lua8
-rw-r--r--test/functional/api/vim_spec.lua85
-rw-r--r--test/functional/api/window_spec.lua40
16 files changed, 210 insertions, 187 deletions
diff --git a/test/functional/api/autocmd_spec.lua b/test/functional/api/autocmd_spec.lua
index d2ec3a576c..3f9883f43f 100644
--- a/test/functional/api/autocmd_spec.lua
+++ b/test/functional/api/autocmd_spec.lua
@@ -1,13 +1,14 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
local neq = t.neq
-local exec_lua = t.exec_lua
+local exec_lua = n.exec_lua
local matches = t.matches
-local api = t.api
-local source = t.source
+local api = n.api
+local source = n.source
local pcall_err = t.pcall_err
before_each(clear)
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index 12b2c43158..cf69958fd8 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -1,21 +1,23 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
+
+local clear = n.clear
local eq = t.eq
local ok = t.ok
-local describe_lua_and_rpc = t.describe_lua_and_rpc(describe)
-local api = t.api
-local fn = t.fn
-local request = t.request
-local exc_exec = t.exc_exec
-local exec_lua = t.exec_lua
-local feed_command = t.feed_command
-local insert = t.insert
+local describe_lua_and_rpc = n.describe_lua_and_rpc(describe)
+local api = n.api
+local fn = n.fn
+local request = n.request
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local feed_command = n.feed_command
+local insert = n.insert
local NIL = vim.NIL
-local command = t.command
-local feed = t.feed
+local command = n.command
+local feed = n.feed
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('api/buf', function()
before_each(clear)
@@ -2066,7 +2068,7 @@ describe('api/buf', function()
end)
after_each(function()
- t.rmdir(topdir .. '/Xacd')
+ n.rmdir(topdir .. '/Xacd')
end)
it('does not change cwd with non-current buffer', function()
diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua
index 494bc4495b..e030b45396 100644
--- a/test/functional/api/buffer_updates_spec.lua
+++ b/test/functional/api/buffer_updates_spec.lua
@@ -1,10 +1,12 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
local eq, ok = t.eq, t.ok
-local fn = t.fn
-local api = t.api
-local command, eval, next_msg = t.command, t.eval, t.next_msg
-local nvim_prog = t.nvim_prog
+local fn = n.fn
+local api = n.api
+local command, eval, next_msg = n.command, n.eval, n.next_msg
+local nvim_prog = n.nvim_prog
local pcall_err = t.pcall_err
local sleep = vim.uv.sleep
local write_file = t.write_file
@@ -511,11 +513,11 @@ describe('API: buffer events:', function()
-- create several new sessions, in addition to our main API
local sessions = {}
- local pipe = t.new_pipename()
+ local pipe = n.new_pipename()
eval("serverstart('" .. pipe .. "')")
- sessions[1] = t.connect(pipe)
- sessions[2] = t.connect(pipe)
- sessions[3] = t.connect(pipe)
+ sessions[1] = n.connect(pipe)
+ sessions[2] = n.connect(pipe)
+ sessions[3] = n.connect(pipe)
local function request(sessionnr, method, ...)
local status, rv = sessions[sessionnr]:request(method, ...)
@@ -814,7 +816,7 @@ describe('API: buffer events:', function()
clear()
sleep(250)
-- response
- eq(true, t.request('nvim_buf_attach', 0, false, {}))
+ eq(true, n.request('nvim_buf_attach', 0, false, {}))
-- notification
eq({
[1] = 'notification',
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index 6c51fac178..a16c6a88e3 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -1,17 +1,18 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local NIL = vim.NIL
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local api = t.api
+local api = n.api
local matches = t.matches
-local source = t.source
+local source = n.source
local pcall_err = t.pcall_err
-local exec_lua = t.exec_lua
-local assert_alive = t.assert_alive
-local feed = t.feed
-local fn = t.fn
+local exec_lua = n.exec_lua
+local assert_alive = n.assert_alive
+local feed = n.feed
+local fn = n.fn
describe('nvim_get_commands', function()
local cmd_dict = {
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua
index 82e7ad3988..70bdb050e5 100644
--- a/test/functional/api/extmark_spec.lua
+++ b/test/functional/api/extmark_spec.lua
@@ -1,20 +1,21 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local request = t.request
+local request = n.request
local eq = t.eq
local ok = t.ok
local pcall_err = t.pcall_err
-local insert = t.insert
-local feed = t.feed
-local clear = t.clear
-local command = t.command
-local exec = t.exec
-local api = t.api
-local assert_alive = t.assert_alive
+local insert = n.insert
+local feed = n.feed
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local api = n.api
+local assert_alive = n.assert_alive
local function expect(contents)
- return eq(contents, t.curbuf_contents())
+ return eq(contents, n.curbuf_contents())
end
local function set_extmark(ns_id, id, line, col, opts)
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 50e79f8860..dd0611f184 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -1,14 +1,16 @@
-local t = require('test.functional.testutil')()
-local clear = t.clear
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local eq, eval = t.eq, t.eval
-local command = t.command
-local exec_capture = t.exec_capture
-local api = t.api
-local fn = t.fn
+
+local clear = n.clear
+local eq, eval = t.eq, n.eval
+local command = n.command
+local exec_capture = n.exec_capture
+local api = n.api
+local fn = n.fn
local pcall_err = t.pcall_err
local ok = t.ok
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('API: highlight', function()
clear()
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua
index f0ed04e88e..995711507f 100644
--- a/test/functional/api/keymap_spec.lua
+++ b/test/functional/api/keymap_spec.lua
@@ -1,15 +1,16 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
-local command = t.command
+local clear = n.clear
+local command = n.command
local eq, neq = t.eq, t.neq
-local exec_lua = t.exec_lua
-local exec = t.exec
-local feed = t.feed
-local fn = t.fn
-local api = t.api
+local exec_lua = n.exec_lua
+local exec = n.exec
+local feed = n.feed
+local fn = n.fn
+local api = n.api
local matches = t.matches
-local source = t.source
+local source = n.source
local pcall_err = t.pcall_err
local shallowcopy = t.shallowcopy
@@ -1146,7 +1147,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
feed('asdf\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap asdf'))
+ eq('\nNo mapping found', n.exec_capture('nmap asdf'))
end)
it('no double-free when unmapping simplifiable lua mappings', function()
@@ -1170,13 +1171,13 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
feed('<C-I>\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap <C-I>'))
+ eq('\nNo mapping found', n.exec_capture('nmap <C-I>'))
end)
it('can set descriptions on mappings', function()
api.nvim_set_keymap('n', 'lhs', 'rhs', { desc = 'map description' })
eq(generate_mapargs('n', 'lhs', 'rhs', { desc = 'map description' }), get_mapargs('n', 'lhs'))
- eq('\nn lhs rhs\n map description', t.exec_capture('nmap lhs'))
+ eq('\nn lhs rhs\n map description', n.exec_capture('nmap lhs'))
end)
it('can define !-mode abbreviations with lua callbacks', function()
@@ -1331,7 +1332,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
it('does not crash when setting mapping in a non-existing buffer #13541', function()
pcall_err(api.nvim_buf_set_keymap, 100, '', 'lsh', 'irhs<Esc>', {})
- t.assert_alive()
+ n.assert_alive()
end)
it('can make lua mappings', function()
@@ -1426,7 +1427,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
feed('asdf\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap asdf'))
+ eq('\nNo mapping found', n.exec_capture('nmap asdf'))
end)
it('no double-free when unmapping simplifiable lua mappings', function()
@@ -1450,6 +1451,6 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
feed('<C-I>\n')
eq(1, exec_lua [[return GlobalCount]])
- eq('\nNo mapping found', t.exec_capture('nmap <C-I>'))
+ eq('\nNo mapping found', n.exec_capture('nmap <C-I>'))
end)
end)
diff --git a/test/functional/api/menu_spec.lua b/test/functional/api/menu_spec.lua
index 2e6fdd6551..76eef164c9 100644
--- a/test/functional/api/menu_spec.lua
+++ b/test/functional/api/menu_spec.lua
@@ -1,9 +1,9 @@
-local t = require('test.functional.testutil')()
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
-local feed = t.feed
+local clear = n.clear
+local command = n.command
+local feed = n.feed
describe('update_menu notification', function()
local screen
diff --git a/test/functional/api/proc_spec.lua b/test/functional/api/proc_spec.lua
index 1b090aa30d..d2dd655b17 100644
--- a/test/functional/api/proc_spec.lua
+++ b/test/functional/api/proc_spec.lua
@@ -1,11 +1,12 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear = t.clear
+local clear = n.clear
local eq = t.eq
-local fn = t.fn
+local fn = n.fn
local neq = t.neq
-local nvim_argv = t.nvim_argv
-local request = t.request
+local nvim_argv = n.nvim_argv
+local request = n.request
local retry = t.retry
local NIL = vim.NIL
local is_os = t.is_os
diff --git a/test/functional/api/server_notifications_spec.lua b/test/functional/api/server_notifications_spec.lua
index fd7e596016..b8efbfbd0e 100644
--- a/test/functional/api/server_notifications_spec.lua
+++ b/test/functional/api/server_notifications_spec.lua
@@ -1,11 +1,13 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
local assert_log = t.assert_log
-local eq, clear, eval, command, next_msg = t.eq, t.clear, t.eval, t.command, t.next_msg
-local api = t.api
-local exec_lua = t.exec_lua
+local eq, clear, eval, command, next_msg = t.eq, n.clear, n.eval, n.command, n.next_msg
+local api = n.api
+local exec_lua = n.exec_lua
local retry = t.retry
-local assert_alive = t.assert_alive
-local check_close = t.check_close
+local assert_alive = n.assert_alive
+local check_close = n.check_close
local testlog = 'Xtest-server-notify-log'
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index 5385b23ec1..bdd340f6c6 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -1,17 +1,18 @@
-- Test server -> client RPC scenarios. Note: unlike `rpcnotify`, to evaluate
-- `rpcrequest` calls we need the client event loop to be running.
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
-local clear, eval = t.clear, t.eval
-local eq, neq, run, stop = t.eq, t.neq, t.run, t.stop
-local nvim_prog, command, fn = t.nvim_prog, t.command, t.fn
-local source, next_msg = t.source, t.next_msg
+local clear, eval = n.clear, n.eval
+local eq, neq, run, stop = t.eq, t.neq, n.run, n.stop
+local nvim_prog, command, fn = n.nvim_prog, n.command, n.fn
+local source, next_msg = n.source, n.next_msg
local ok = t.ok
-local api = t.api
-local spawn, merge_args = t.spawn, t.merge_args
-local set_session = t.set_session
+local api = n.api
+local spawn, merge_args = n.spawn, n.merge_args
+local set_session = n.set_session
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('server -> client', function()
local cid
@@ -91,19 +92,19 @@ describe('server -> client', function()
local function on_request(method, args)
eq('rcall', method)
- local n = unpack(args) * 2
- if n <= 16 then
+ local _n = unpack(args) * 2
+ if _n <= 16 then
local cmd
- if n == 4 then
- cmd = 'let g:result2 = rpcrequest(' .. cid .. ', "rcall", ' .. n .. ')'
- elseif n == 8 then
- cmd = 'let g:result3 = rpcrequest(' .. cid .. ', "rcall", ' .. n .. ')'
- elseif n == 16 then
- cmd = 'let g:result4 = rpcrequest(' .. cid .. ', "rcall", ' .. n .. ')'
+ if _n == 4 then
+ cmd = 'let g:result2 = rpcrequest(' .. cid .. ', "rcall", ' .. _n .. ')'
+ elseif _n == 8 then
+ cmd = 'let g:result3 = rpcrequest(' .. cid .. ', "rcall", ' .. _n .. ')'
+ elseif _n == 16 then
+ cmd = 'let g:result4 = rpcrequest(' .. cid .. ', "rcall", ' .. _n .. ')'
end
command(cmd)
end
- return n
+ return _n
end
run(on_request, nil, on_setup)
end)
@@ -280,7 +281,7 @@ describe('server -> client', function()
end)
describe('connecting to another (peer) nvim', function()
- local nvim_argv = merge_args(t.nvim_argv, { '--headless' })
+ local nvim_argv = merge_args(n.nvim_argv, { '--headless' })
local function connect_test(server, mode, address)
local serverpid = fn.getpid()
local client = spawn(nvim_argv, false, nil, true)
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
index 328e3aa653..74858475c8 100644
--- a/test/functional/api/tabpage_spec.lua
+++ b/test/functional/api/tabpage_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
-local clear, eq, ok = t.clear, t.eq, t.ok
-local exec = t.exec
-local feed = t.feed
-local api = t.api
-local fn = t.fn
-local request = t.request
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, eq, ok = n.clear, t.eq, t.ok
+local exec = n.exec
+local feed = n.feed
+local api = n.api
+local fn = n.fn
+local request = n.request
local NIL = vim.NIL
local pcall_err = t.pcall_err
-local command = t.command
+local command = n.command
describe('api/tabpage', function()
before_each(clear)
diff --git a/test/functional/api/ui_spec.lua b/test/functional/api/ui_spec.lua
index 36fa71f2ec..2145db7f8a 100644
--- a/test/functional/api/ui_spec.lua
+++ b/test/functional/api/ui_spec.lua
@@ -1,13 +1,15 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = t.clear
-local command = t.command
+
+local clear = n.clear
+local command = n.command
local eq = t.eq
-local eval = t.eval
-local exec = t.exec
-local feed = t.feed
-local api = t.api
-local request = t.request
+local eval = n.eval
+local exec = n.exec
+local feed = n.feed
+local api = n.api
+local request = n.request
local pcall_err = t.pcall_err
describe('nvim_ui_attach()', function()
diff --git a/test/functional/api/version_spec.lua b/test/functional/api/version_spec.lua
index b57f67369e..5dad9978b7 100644
--- a/test/functional/api/version_spec.lua
+++ b/test/functional/api/version_spec.lua
@@ -1,6 +1,8 @@
-local t = require('test.functional.testutil')()
-local clear, fn, eq = t.clear, t.fn, t.eq
-local api = t.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, fn, eq = n.clear, n.fn, t.eq
+local api = n.api
local function read_mpack_file(fname)
local fd = io.open(fname, 'rb')
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index c412773482..2d3871a37d 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1,36 +1,37 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local uv = vim.uv
local fmt = string.format
local dedent = t.dedent
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
local NIL = vim.NIL
-local clear, eq, neq = t.clear, t.eq, t.neq
-local command = t.command
-local command_output = t.api.nvim_command_output
-local exec = t.exec
-local exec_capture = t.exec_capture
-local eval = t.eval
-local expect = t.expect
-local fn = t.fn
-local api = t.api
+local clear, eq, neq = n.clear, t.eq, t.neq
+local command = n.command
+local command_output = n.api.nvim_command_output
+local exec = n.exec
+local exec_capture = n.exec_capture
+local eval = n.eval
+local expect = n.expect
+local fn = n.fn
+local api = n.api
local matches = t.matches
local pesc = vim.pesc
-local mkdir_p = t.mkdir_p
-local ok, nvim_async, feed = t.ok, t.nvim_async, t.feed
-local async_meths = t.async_meths
+local mkdir_p = n.mkdir_p
+local ok, nvim_async, feed = t.ok, n.nvim_async, n.feed
+local async_meths = n.async_meths
local is_os = t.is_os
-local parse_context = t.parse_context
-local request = t.request
-local rmdir = t.rmdir
-local source = t.source
-local next_msg = t.next_msg
+local parse_context = n.parse_context
+local request = n.request
+local rmdir = n.rmdir
+local source = n.source
+local next_msg = n.next_msg
local tmpname = t.tmpname
local write_file = t.write_file
-local exec_lua = t.exec_lua
-local exc_exec = t.exc_exec
-local insert = t.insert
+local exec_lua = n.exec_lua
+local exc_exec = n.exc_exec
+local insert = n.insert
local skip = t.skip
local pcall_err = t.pcall_err
@@ -722,12 +723,12 @@ describe('API', function()
end)
after_each(function()
- t.rmdir('Xtestdir')
+ n.rmdir('Xtestdir')
end)
it('works', function()
api.nvim_set_current_dir('Xtestdir')
- eq(start_dir .. t.get_pathsep() .. 'Xtestdir', fn.getcwd())
+ eq(start_dir .. n.get_pathsep() .. 'Xtestdir', fn.getcwd())
end)
it('sets previous directory', function()
@@ -1487,7 +1488,7 @@ describe('API', function()
eq(NIL, api.nvim_get_var('Unknown_script_func'))
-- Check if autoload works properly
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
local xconfig = 'Xhome' .. pathsep .. 'Xconfig'
local xdata = 'Xhome' .. pathsep .. 'Xdata'
local autoload_folder = table.concat({ xconfig, 'nvim', 'autoload' }, pathsep)
@@ -1971,7 +1972,7 @@ describe('API', function()
describe('RPC (K_EVENT)', function()
it('does not complete ("interrupt") normal-mode operator-pending #6166', function()
- t.insert([[
+ n.insert([[
FIRST LINE
SECOND LINE]])
api.nvim_input('gg')
@@ -2008,7 +2009,7 @@ describe('API', function()
it('does not complete ("interrupt") normal-mode map-pending #6166', function()
command("nnoremap dd :let g:foo='it worked...'<CR>")
- t.insert([[
+ n.insert([[
FIRST LINE
SECOND LINE]])
api.nvim_input('gg')
@@ -2020,13 +2021,13 @@ describe('API', function()
expect([[
FIRST LINE
SECOND LINE]])
- eq('it worked...', t.eval('g:foo'))
+ eq('it worked...', n.eval('g:foo'))
end)
it('does not complete ("interrupt") insert-mode map-pending #6166', function()
command('inoremap xx foo')
command('set timeoutlen=9999')
- t.insert([[
+ n.insert([[
FIRST LINE
SECOND LINE]])
api.nvim_input('ix')
@@ -2173,32 +2174,32 @@ describe('API', function()
describe('nvim_replace_termcodes', function()
it('escapes K_SPECIAL as K_SPECIAL KS_SPECIAL KE_FILLER', function()
- eq('\128\254X', t.api.nvim_replace_termcodes('\128', true, true, true))
+ eq('\128\254X', n.api.nvim_replace_termcodes('\128', true, true, true))
end)
it('leaves non-K_SPECIAL string unchanged', function()
- eq('abc', t.api.nvim_replace_termcodes('abc', true, true, true))
+ eq('abc', n.api.nvim_replace_termcodes('abc', true, true, true))
end)
it('converts <expressions>', function()
- eq('\\', t.api.nvim_replace_termcodes('<Leader>', true, true, true))
+ eq('\\', n.api.nvim_replace_termcodes('<Leader>', true, true, true))
end)
it('converts <LeftMouse> to K_SPECIAL KS_EXTRA KE_LEFTMOUSE', function()
-- K_SPECIAL KS_EXTRA KE_LEFTMOUSE
-- 0x80 0xfd 0x2c
-- 128 253 44
- eq('\128\253\44', t.api.nvim_replace_termcodes('<LeftMouse>', true, true, true))
+ eq('\128\253\44', n.api.nvim_replace_termcodes('<LeftMouse>', true, true, true))
end)
it('converts keycodes', function()
- eq('\nx\27x\rx<x', t.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, true))
+ eq('\nx\27x\rx<x', n.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, true))
end)
it('does not convert keycodes if special=false', function()
eq(
'<NL>x<Esc>x<CR>x<lt>x',
- t.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, false)
+ n.api.nvim_replace_termcodes('<NL>x<Esc>x<CR>x<lt>x', true, true, false)
)
end)
@@ -2227,18 +2228,18 @@ describe('API', function()
api.nvim_feedkeys(':let x1="…"\n', '', true)
-- Both nvim_replace_termcodes and nvim_feedkeys escape \x80
- local inp = t.api.nvim_replace_termcodes(':let x2="…"<CR>', true, true, true)
+ local inp = n.api.nvim_replace_termcodes(':let x2="…"<CR>', true, true, true)
api.nvim_feedkeys(inp, '', true) -- escape_ks=true
-- nvim_feedkeys with K_SPECIAL escaping disabled
- inp = t.api.nvim_replace_termcodes(':let x3="…"<CR>', true, true, true)
+ inp = n.api.nvim_replace_termcodes(':let x3="…"<CR>', true, true, true)
api.nvim_feedkeys(inp, '', false) -- escape_ks=false
- t.stop()
+ n.stop()
end
-- spin the loop a bit
- t.run(nil, nil, on_setup)
+ n.run(nil, nil, on_setup)
eq('…', api.nvim_get_var('x1'))
-- Because of the double escaping this is neq
@@ -2381,7 +2382,7 @@ describe('API', function()
{0:~ }|*6
{1:very fail} |
]])
- t.poke_eventloop()
+ n.poke_eventloop()
-- shows up to &cmdheight lines
async_meths.nvim_err_write('more fail\ntoo fail\n')
@@ -2693,7 +2694,7 @@ describe('API', function()
describe('nvim_list_runtime_paths', function()
setup(function()
- local pathsep = t.get_pathsep()
+ local pathsep = n.get_pathsep()
mkdir_p('Xtest' .. pathsep .. 'a')
mkdir_p('Xtest' .. pathsep .. 'b')
end)
@@ -3200,7 +3201,7 @@ describe('API', function()
end)
describe('nvim_get_runtime_file', function()
- local p = t.alter_slashes
+ local p = n.alter_slashes
it('can find files', function()
eq({}, api.nvim_get_runtime_file('bork.borkbork', false))
eq({}, api.nvim_get_runtime_file('bork.borkbork', true))
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 36966b68f5..636338cb2e 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -1,27 +1,29 @@
-local t = require('test.functional.testutil')()
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+
local clear, curbuf, curbuf_contents, curwin, eq, neq, matches, ok, feed, insert, eval =
- t.clear,
- t.api.nvim_get_current_buf,
- t.curbuf_contents,
- t.api.nvim_get_current_win,
+ n.clear,
+ n.api.nvim_get_current_buf,
+ n.curbuf_contents,
+ n.api.nvim_get_current_win,
t.eq,
t.neq,
t.matches,
t.ok,
- t.feed,
- t.insert,
- t.eval
-local poke_eventloop = t.poke_eventloop
-local exec = t.exec
-local exec_lua = t.exec_lua
-local fn = t.fn
-local request = t.request
+ n.feed,
+ n.insert,
+ n.eval
+local poke_eventloop = n.poke_eventloop
+local exec = n.exec
+local exec_lua = n.exec_lua
+local fn = n.fn
+local request = n.request
local NIL = vim.NIL
-local api = t.api
-local command = t.command
+local api = n.api
+local command = n.command
local pcall_err = t.pcall_err
-local assert_alive = t.assert_alive
+local assert_alive = n.assert_alive
describe('API/win', function()
before_each(clear)
@@ -136,7 +138,7 @@ describe('API/win', function()
end)
after_each(function()
- t.rmdir(topdir .. '/Xacd')
+ n.rmdir(topdir .. '/Xacd')
end)
it('does not change cwd with non-current window', function()
@@ -1370,7 +1372,7 @@ describe('API/win', function()
local tab1 = api.nvim_get_current_tabpage()
local tab1_win = api.nvim_get_current_win()
- t.command('tabnew')
+ n.command('tabnew')
local tab2 = api.nvim_get_current_tabpage()
local tab2_win = api.nvim_get_current_win()
@@ -1790,7 +1792,7 @@ describe('API/win', function()
end)
after_each(function()
- t.rmdir(topdir .. '/Xacd')
+ n.rmdir(topdir .. '/Xacd')
end)
it('does not change cwd with enter=false #15280', function()