aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/api')
-rw-r--r--test/functional/api/command_spec.lua9
-rw-r--r--test/functional/api/server_requests_spec.lua16
2 files changed, 16 insertions, 9 deletions
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index a16c6a88e3..fabd9be6d6 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -651,6 +651,11 @@ describe('nvim_create_user_command', function()
api.nvim_set_current_buf(bufnr)
command('Hello')
assert_alive()
+ eq(
+ 'Invalid buffer id: 1234',
+ pcall_err(api.nvim_buf_create_user_command, 1234, 'Hello', '', {})
+ )
+ assert_alive()
end)
it('can use a Lua complete function', function()
@@ -771,5 +776,9 @@ describe('nvim_del_user_command', function()
command('Hello')
api.nvim_buf_del_user_command(0, 'Hello')
matches('Not an editor command: Hello', pcall_err(command, 'Hello'))
+ eq('Invalid command (not found): Hello', pcall_err(api.nvim_buf_del_user_command, 0, 'Hello'))
+ eq('Invalid command (not found): Bye', pcall_err(api.nvim_buf_del_user_command, 0, 'Bye'))
+ eq('Invalid buffer id: 1234', pcall_err(api.nvim_buf_del_user_command, 1234, 'Hello'))
+ assert_alive()
end)
end)
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index bdd340f6c6..c022ba28de 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -9,7 +9,6 @@ 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 = 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 = n.assert_alive
@@ -281,10 +280,9 @@ describe('server -> client', function()
end)
describe('connecting to another (peer) nvim', function()
- 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)
+ local client = n.new_session(true)
set_session(client)
local clientpid = fn.getpid()
@@ -312,7 +310,7 @@ describe('server -> client', function()
end
it('via named pipe', function()
- local server = spawn(nvim_argv)
+ local server = n.new_session(false)
set_session(server)
local address = fn.serverlist()[1]
local first = string.sub(address, 1, 1)
@@ -321,7 +319,7 @@ describe('server -> client', function()
end)
it('via ipv4 address', function()
- local server = spawn(nvim_argv)
+ local server = n.new_session(false)
set_session(server)
local status, address = pcall(fn.serverstart, '127.0.0.1:')
if not status then
@@ -332,7 +330,7 @@ describe('server -> client', function()
end)
it('via ipv6 address', function()
- local server = spawn(nvim_argv)
+ local server = n.new_session(false)
set_session(server)
local status, address = pcall(fn.serverstart, '::1:')
if not status then
@@ -343,7 +341,7 @@ describe('server -> client', function()
end)
it('via hostname', function()
- local server = spawn(nvim_argv)
+ local server = n.new_session(false)
set_session(server)
local address = fn.serverstart('localhost:')
eq('localhost:', string.sub(address, 1, 10))
@@ -351,10 +349,10 @@ describe('server -> client', function()
end)
it('does not crash on receiving UI events', function()
- local server = spawn(nvim_argv)
+ local server = n.new_session(false)
set_session(server)
local address = fn.serverlist()[1]
- local client = spawn(nvim_argv, false, nil, true)
+ local client = n.new_session(true)
set_session(client)
local id = fn.sockconnect('pipe', address, { rpc = true })