2017-01-20 14:00:47 -07:00
|
|
|
-- Test suite for testing interactions with API bindings
|
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
|
|
|
|
2017-01-20 15:10:44 -07:00
|
|
|
local exc_exec = helpers.exc_exec
|
2021-11-06 07:26:10 -07:00
|
|
|
local remove_trace = helpers.remove_trace
|
2017-01-20 14:00:47 -07:00
|
|
|
local funcs = helpers.funcs
|
|
|
|
local clear = helpers.clear
|
2017-01-20 15:10:44 -07:00
|
|
|
local eval = helpers.eval
|
2017-01-20 14:00:47 -07:00
|
|
|
local NIL = helpers.NIL
|
|
|
|
local eq = helpers.eq
|
2021-12-22 11:40:21 -07:00
|
|
|
local exec_lua = helpers.exec_lua
|
2023-08-09 11:25:16 -07:00
|
|
|
local pcall_err = helpers.pcall_err
|
2017-01-20 14:00:47 -07:00
|
|
|
|
|
|
|
before_each(clear)
|
|
|
|
|
|
|
|
describe('luaeval(vim.api.…)', function()
|
|
|
|
describe('with channel_id and buffer handle', function()
|
|
|
|
describe('nvim_buf_get_lines', function()
|
|
|
|
it('works', function()
|
|
|
|
funcs.setline(1, {"abc", "def", "a\nb", "ttt"})
|
2021-07-31 13:45:58 -07:00
|
|
|
eq({'a\000b'},
|
2017-01-20 14:00:47 -07:00
|
|
|
funcs.luaeval('vim.api.nvim_buf_get_lines(1, 2, 3, false)'))
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
describe('nvim_buf_set_lines', function()
|
|
|
|
it('works', function()
|
|
|
|
funcs.setline(1, {"abc", "def", "a\nb", "ttt"})
|
|
|
|
eq(NIL, funcs.luaeval('vim.api.nvim_buf_set_lines(1, 1, 2, false, {"b\\0a"})'))
|
2021-07-31 13:45:58 -07:00
|
|
|
eq({'abc', 'b\000a', 'a\000b', 'ttt'},
|
2017-01-20 14:00:47 -07:00
|
|
|
funcs.luaeval('vim.api.nvim_buf_get_lines(1, 0, 4, false)'))
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
describe('with errors', function()
|
2017-04-11 00:38:57 -07:00
|
|
|
it('transforms API error from nvim_buf_set_lines into lua error', function()
|
2017-01-20 14:00:47 -07:00
|
|
|
funcs.setline(1, {"abc", "def", "a\nb", "ttt"})
|
2023-02-14 06:07:38 -07:00
|
|
|
eq({false, "'replacement string' item contains newlines"},
|
2017-01-20 14:00:47 -07:00
|
|
|
funcs.luaeval('{pcall(vim.api.nvim_buf_set_lines, 1, 1, 2, false, {"b\\na"})}'))
|
|
|
|
end)
|
2017-04-10 16:32:13 -07:00
|
|
|
|
2017-04-11 00:38:57 -07:00
|
|
|
it('transforms API error from nvim_win_set_cursor into lua error', function()
|
2017-04-10 16:32:13 -07:00
|
|
|
eq({false, 'Argument "pos" must be a [row, col] array'},
|
2017-05-08 11:06:23 -07:00
|
|
|
funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, 0, {1, 2, 3})}'))
|
|
|
|
-- Used to produce a memory leak due to a bug in nvim_win_set_cursor
|
2020-01-14 01:21:10 -07:00
|
|
|
eq({false, 'Invalid window id: -1'},
|
2017-05-08 11:06:23 -07:00
|
|
|
funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, -1, {1, 2, 3})}'))
|
2017-04-10 16:32:13 -07:00
|
|
|
end)
|
2017-04-11 00:38:57 -07:00
|
|
|
|
|
|
|
it('transforms API error from nvim_win_set_cursor + same array as in first test into lua error',
|
|
|
|
function()
|
|
|
|
eq({false, 'Argument "pos" must be a [row, col] array'},
|
2017-05-08 11:06:23 -07:00
|
|
|
funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, 0, {"b\\na"})}'))
|
2017-04-11 00:38:57 -07:00
|
|
|
end)
|
2017-01-20 14:00:47 -07:00
|
|
|
end)
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2017-01-20 15:52:19 -07:00
|
|
|
it('correctly evaluates API code which calls luaeval', function()
|
2017-04-10 15:18:42 -07:00
|
|
|
local str = (([===[vim.api.nvim_eval([==[
|
2017-01-20 15:52:19 -07:00
|
|
|
luaeval('vim.api.nvim_eval([=[
|
|
|
|
luaeval("vim.api.nvim_eval([[
|
|
|
|
luaeval(1)
|
|
|
|
]])")
|
|
|
|
]=])')
|
2017-04-10 15:18:42 -07:00
|
|
|
]==])]===]):gsub('\n', ' '))
|
|
|
|
eq(1, funcs.luaeval(str))
|
2017-01-20 15:52:19 -07:00
|
|
|
end)
|
|
|
|
|
2017-01-20 15:10:44 -07:00
|
|
|
it('correctly converts from API objects', function()
|
|
|
|
eq(1, funcs.luaeval('vim.api.nvim_eval("1")'))
|
|
|
|
eq('1', funcs.luaeval([[vim.api.nvim_eval('"1"')]]))
|
2021-08-02 11:13:48 -07:00
|
|
|
eq('Blobby', funcs.luaeval('vim.api.nvim_eval("0z426c6f626279")'))
|
2017-01-20 15:10:44 -07:00
|
|
|
eq({}, funcs.luaeval('vim.api.nvim_eval("[]")'))
|
|
|
|
eq({}, funcs.luaeval('vim.api.nvim_eval("{}")'))
|
|
|
|
eq(1, funcs.luaeval('vim.api.nvim_eval("1.0")'))
|
2021-07-31 13:45:58 -07:00
|
|
|
eq('\000', funcs.luaeval('vim.api.nvim_eval("0z00")'))
|
2017-01-20 15:10:44 -07:00
|
|
|
eq(true, funcs.luaeval('vim.api.nvim_eval("v:true")'))
|
|
|
|
eq(false, funcs.luaeval('vim.api.nvim_eval("v:false")'))
|
|
|
|
eq(NIL, funcs.luaeval('vim.api.nvim_eval("v:null")'))
|
|
|
|
|
|
|
|
eq(0, eval([[type(luaeval('vim.api.nvim_eval("1")'))]]))
|
|
|
|
eq(1, eval([[type(luaeval('vim.api.nvim_eval("''1''")'))]]))
|
2021-08-02 11:13:48 -07:00
|
|
|
eq(1, eval([[type(luaeval('vim.api.nvim_eval("0zbeef")'))]]))
|
2017-01-20 15:10:44 -07:00
|
|
|
eq(3, eval([[type(luaeval('vim.api.nvim_eval("[]")'))]]))
|
|
|
|
eq(4, eval([[type(luaeval('vim.api.nvim_eval("{}")'))]]))
|
|
|
|
eq(5, eval([[type(luaeval('vim.api.nvim_eval("1.0")'))]]))
|
|
|
|
eq(6, eval([[type(luaeval('vim.api.nvim_eval("v:true")'))]]))
|
|
|
|
eq(6, eval([[type(luaeval('vim.api.nvim_eval("v:false")'))]]))
|
|
|
|
eq(7, eval([[type(luaeval('vim.api.nvim_eval("v:null")'))]]))
|
|
|
|
|
|
|
|
eq({foo=42}, funcs.luaeval([[vim.api.nvim_eval('{"foo": 42}')]]))
|
|
|
|
eq({42}, funcs.luaeval([[vim.api.nvim_eval('[42]')]]))
|
|
|
|
|
|
|
|
eq({foo={bar=42}, baz=50}, funcs.luaeval([[vim.api.nvim_eval('{"foo": {"bar": 42}, "baz": 50}')]]))
|
|
|
|
eq({{42}, {}}, funcs.luaeval([=[vim.api.nvim_eval('[[42], []]')]=]))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('correctly converts to API objects', function()
|
2017-04-08 10:33:48 -07:00
|
|
|
eq(1, funcs.luaeval('vim.api.nvim__id(1)'))
|
|
|
|
eq('1', funcs.luaeval('vim.api.nvim__id("1")'))
|
|
|
|
eq({1}, funcs.luaeval('vim.api.nvim__id({1})'))
|
|
|
|
eq({foo=1}, funcs.luaeval('vim.api.nvim__id({foo=1})'))
|
|
|
|
eq(1.5, funcs.luaeval('vim.api.nvim__id(1.5)'))
|
|
|
|
eq(true, funcs.luaeval('vim.api.nvim__id(true)'))
|
|
|
|
eq(false, funcs.luaeval('vim.api.nvim__id(false)'))
|
|
|
|
eq(NIL, funcs.luaeval('vim.api.nvim__id(nil)'))
|
|
|
|
|
2022-02-26 06:27:43 -07:00
|
|
|
-- API strings from Blobs can work as NUL-terminated C strings
|
2023-04-16 03:27:33 -07:00
|
|
|
eq('Vim(call):E5555: API call: Vim:E15: Invalid expression: ""',
|
2022-02-26 06:27:43 -07:00
|
|
|
exc_exec('call nvim_eval(v:_null_blob)'))
|
2023-04-16 03:27:33 -07:00
|
|
|
eq('Vim(call):E5555: API call: Vim:E15: Invalid expression: ""',
|
2022-02-26 06:27:43 -07:00
|
|
|
exc_exec('call nvim_eval(0z)'))
|
|
|
|
eq(1, eval('nvim_eval(0z31)'))
|
|
|
|
|
2017-04-08 10:33:48 -07:00
|
|
|
eq(0, eval([[type(luaeval('vim.api.nvim__id(1)'))]]))
|
|
|
|
eq(1, eval([[type(luaeval('vim.api.nvim__id("1")'))]]))
|
|
|
|
eq(3, eval([[type(luaeval('vim.api.nvim__id({1})'))]]))
|
|
|
|
eq(4, eval([[type(luaeval('vim.api.nvim__id({foo=1})'))]]))
|
|
|
|
eq(5, eval([[type(luaeval('vim.api.nvim__id(1.5)'))]]))
|
|
|
|
eq(6, eval([[type(luaeval('vim.api.nvim__id(true)'))]]))
|
|
|
|
eq(6, eval([[type(luaeval('vim.api.nvim__id(false)'))]]))
|
|
|
|
eq(7, eval([[type(luaeval('vim.api.nvim__id(nil)'))]]))
|
|
|
|
|
|
|
|
eq({foo=1, bar={42, {{baz=true}, 5}}}, funcs.luaeval('vim.api.nvim__id({foo=1, bar={42, {{baz=true}, 5}}})'))
|
2021-12-22 11:40:21 -07:00
|
|
|
|
|
|
|
eq(true, funcs.luaeval('vim.api.nvim__id(vim.api.nvim__id)(true)'))
|
|
|
|
eq(42, exec_lua [[
|
|
|
|
local f = vim.api.nvim__id({42, vim.api.nvim__id})
|
|
|
|
return f[2](f[1])
|
|
|
|
]])
|
2017-01-20 15:10:44 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('correctly converts container objects with type_idx to API objects', function()
|
2017-04-08 10:33:48 -07:00
|
|
|
eq(5, eval('type(luaeval("vim.api.nvim__id({[vim.type_idx]=vim.types.float, [vim.val_idx]=0})"))'))
|
|
|
|
eq(4, eval([[type(luaeval('vim.api.nvim__id({[vim.type_idx]=vim.types.dictionary})'))]]))
|
|
|
|
eq(3, eval([[type(luaeval('vim.api.nvim__id({[vim.type_idx]=vim.types.array})'))]]))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({}, funcs.luaeval('vim.api.nvim__id({[vim.type_idx]=vim.types.array})'))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
|
|
|
-- Presence of type_idx makes Vim ignore some keys
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({42}, funcs.luaeval('vim.api.nvim__id({[vim.type_idx]=vim.types.array, [vim.val_idx]=10, [5]=1, foo=2, [1]=42})'))
|
|
|
|
eq({foo=2}, funcs.luaeval('vim.api.nvim__id({[vim.type_idx]=vim.types.dictionary, [vim.val_idx]=10, [5]=1, foo=2, [1]=42})'))
|
|
|
|
eq(10, funcs.luaeval('vim.api.nvim__id({[vim.type_idx]=vim.types.float, [vim.val_idx]=10, [5]=1, foo=2, [1]=42})'))
|
|
|
|
eq({}, funcs.luaeval('vim.api.nvim__id({[vim.type_idx]=vim.types.array, [vim.val_idx]=10, [5]=1, foo=2})'))
|
2017-01-20 15:10:44 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('correctly converts arrays with type_idx to API objects', function()
|
2017-04-08 10:33:48 -07:00
|
|
|
eq(3, eval([[type(luaeval('vim.api.nvim__id_array({[vim.type_idx]=vim.types.array})'))]]))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({}, funcs.luaeval('vim.api.nvim__id_array({[vim.type_idx]=vim.types.array})'))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({42}, funcs.luaeval('vim.api.nvim__id_array({[vim.type_idx]=vim.types.array, [vim.val_idx]=10, [5]=1, foo=2, [1]=42})'))
|
|
|
|
eq({{foo=2}}, funcs.luaeval('vim.api.nvim__id_array({{[vim.type_idx]=vim.types.dictionary, [vim.val_idx]=10, [5]=1, foo=2, [1]=42}})'))
|
|
|
|
eq({10}, funcs.luaeval('vim.api.nvim__id_array({{[vim.type_idx]=vim.types.float, [vim.val_idx]=10, [5]=1, foo=2, [1]=42}})'))
|
|
|
|
eq({}, funcs.luaeval('vim.api.nvim__id_array({[vim.type_idx]=vim.types.array, [vim.val_idx]=10, [5]=1, foo=2})'))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({}, funcs.luaeval('vim.api.nvim__id_array({})'))
|
|
|
|
eq(3, eval([[type(luaeval('vim.api.nvim__id_array({})'))]]))
|
2017-01-20 15:10:44 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('correctly converts dictionaries with type_idx to API objects', function()
|
2017-04-08 10:33:48 -07:00
|
|
|
eq(4, eval([[type(luaeval('vim.api.nvim__id_dictionary({[vim.type_idx]=vim.types.dictionary})'))]]))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({}, funcs.luaeval('vim.api.nvim__id_dictionary({[vim.type_idx]=vim.types.dictionary})'))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({v={42}}, funcs.luaeval('vim.api.nvim__id_dictionary({v={[vim.type_idx]=vim.types.array, [vim.val_idx]=10, [5]=1, foo=2, [1]=42}})'))
|
|
|
|
eq({foo=2}, funcs.luaeval('vim.api.nvim__id_dictionary({[vim.type_idx]=vim.types.dictionary, [vim.val_idx]=10, [5]=1, foo=2, [1]=42})'))
|
|
|
|
eq({v=10}, funcs.luaeval('vim.api.nvim__id_dictionary({v={[vim.type_idx]=vim.types.float, [vim.val_idx]=10, [5]=1, foo=2, [1]=42}})'))
|
|
|
|
eq({v={}}, funcs.luaeval('vim.api.nvim__id_dictionary({v={[vim.type_idx]=vim.types.array, [vim.val_idx]=10, [5]=1, foo=2}})'))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
|
|
|
-- If API requests dictionary, then empty table will be the one. This is not
|
|
|
|
-- the case normally because empty table is an empty array.
|
2017-04-08 10:33:48 -07:00
|
|
|
eq({}, funcs.luaeval('vim.api.nvim__id_dictionary({})'))
|
|
|
|
eq(4, eval([[type(luaeval('vim.api.nvim__id_dictionary({})'))]]))
|
2017-01-20 15:10:44 -07:00
|
|
|
end)
|
|
|
|
|
2023-08-09 11:25:16 -07:00
|
|
|
it('converts booleans in positional args', function()
|
|
|
|
eq({''}, exec_lua [[ return vim.api.nvim_buf_get_lines(0, 0, 10, false) ]])
|
|
|
|
eq({''}, exec_lua [[ return vim.api.nvim_buf_get_lines(0, 0, 10, nil) ]])
|
|
|
|
eq('Index out of bounds', pcall_err(exec_lua, [[ return vim.api.nvim_buf_get_lines(0, 0, 10, true) ]]))
|
|
|
|
eq('Index out of bounds', pcall_err(exec_lua, [[ return vim.api.nvim_buf_get_lines(0, 0, 10, 1) ]]))
|
|
|
|
|
|
|
|
-- this follows lua conventions for bools (not api convention for Boolean)
|
|
|
|
eq('Index out of bounds', pcall_err(exec_lua, [[ return vim.api.nvim_buf_get_lines(0, 0, 10, 0) ]]))
|
|
|
|
eq('Index out of bounds', pcall_err(exec_lua, [[ return vim.api.nvim_buf_get_lines(0, 0, 10, {}) ]]))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('converts booleans in optional args', function()
|
|
|
|
eq({}, exec_lua [[ return vim.api.nvim_exec2("echo 'foobar'", {output=false}) ]])
|
|
|
|
eq({}, exec_lua [[ return vim.api.nvim_exec2("echo 'foobar'", {}) ]]) -- same as {output=nil}
|
|
|
|
|
|
|
|
-- API conventions (not lua conventions): zero is falsy
|
|
|
|
eq({}, exec_lua [[ return vim.api.nvim_exec2("echo 'foobar'", {output=0}) ]])
|
|
|
|
|
|
|
|
eq({output='foobar'}, exec_lua [[ return vim.api.nvim_exec2("echo 'foobar'", {output=true}) ]])
|
|
|
|
eq({output='foobar'}, exec_lua [[ return vim.api.nvim_exec2("echo 'foobar'", {output=1}) ]])
|
|
|
|
eq([[Invalid 'output': not a boolean]], pcall_err(exec_lua, [[ return vim.api.nvim_exec2("echo 'foobar'", {output={}}) ]]))
|
|
|
|
end)
|
|
|
|
|
2017-01-20 15:10:44 -07:00
|
|
|
it('errors out correctly when working with API', function()
|
|
|
|
-- Conversion errors
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'obj': Cannot convert given Lua table]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id({1, foo=42})")]])))
|
2017-01-20 15:10:44 -07:00
|
|
|
-- Errors in number of arguments
|
2019-10-30 12:53:09 -07:00
|
|
|
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected 1 argument',
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id()")]])))
|
2019-10-30 12:53:09 -07:00
|
|
|
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected 1 argument',
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id(1, 2)")]])))
|
2019-10-30 12:53:09 -07:00
|
|
|
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected 2 arguments',
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_var(1, 2, 3)")]])))
|
2017-01-20 15:10:44 -07:00
|
|
|
-- Error in argument types
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'name': Expected Lua string]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_var(1, 2)")]])))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'start': Expected Lua number]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 'test', 1, false)")]])))
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'start': Number is not integral]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 1.5, 1, false)")]])))
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'window': Expected Lua number]],
|
2022-01-03 08:00:50 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_win_is_valid(nil)")]])))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'flt': Expected Lua number]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_float('test')")]])))
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'flt': Expected Float-like Lua table]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_float({[vim.type_idx]=vim.types.dictionary})")]])))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'arr': Expected Lua table]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_array(1)")]])))
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'arr': Expected Array-like Lua table]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_array({[vim.type_idx]=vim.types.dictionary})")]])))
|
2017-01-20 15:10:44 -07:00
|
|
|
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'dct': Expected Lua table]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_dictionary(1)")]])))
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'dct': Expected Dict-like Lua table]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_dictionary({[vim.type_idx]=vim.types.array})")]])))
|
2021-10-07 21:31:24 -07:00
|
|
|
|
2023-08-02 04:00:13 -07:00
|
|
|
eq([[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected Lua table]],
|
2021-11-06 07:26:10 -07:00
|
|
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_keymap('', '', '', '')")]])))
|
2021-10-07 21:31:24 -07:00
|
|
|
|
2017-01-20 15:10:44 -07:00
|
|
|
-- TODO: check for errors with Tabpage argument
|
|
|
|
-- TODO: check for errors with Window argument
|
|
|
|
-- TODO: check for errors with Buffer argument
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('accepts any value as API Boolean', function()
|
|
|
|
eq('', funcs.luaeval('vim.api.nvim_replace_termcodes("", vim, false, nil)'))
|
|
|
|
eq('', funcs.luaeval('vim.api.nvim_replace_termcodes("", 0, 1.5, "test")'))
|
|
|
|
eq('', funcs.luaeval('vim.api.nvim_replace_termcodes("", true, {}, {[vim.type_idx]=vim.types.array})'))
|
|
|
|
end)
|
2017-01-20 14:00:47 -07:00
|
|
|
end)
|