aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/verbose_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/ex_cmds/verbose_spec.lua
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-userreg.tar.gz
rneovim-userreg.tar.bz2
rneovim-userreg.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/ex_cmds/verbose_spec.lua')
-rw-r--r--test/functional/ex_cmds/verbose_spec.lua25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua
index 000e746f1c..50077e9e0c 100644
--- a/test/functional/ex_cmds/verbose_spec.lua
+++ b/test/functional/ex_cmds/verbose_spec.lua
@@ -7,7 +7,7 @@ local exec_capture = helpers.exec_capture
local write_file = helpers.write_file
local call_viml_function = helpers.meths.call_function
-describe('lua :verbose', function()
+local function last_set_tests(cmd)
local script_location, script_file
-- All test cases below use the same nvim instance.
setup(function()
@@ -18,17 +18,17 @@ describe('lua :verbose', function()
script_location = table.concat{current_dir, helpers.get_pathsep(), script_file}
write_file(script_file, [[
-vim.api.nvim_set_option('hlsearch', false)
+vim.api.nvim_set_option_value('hlsearch', false, {})
vim.bo.expandtab = true
vim.opt.number = true
vim.api.nvim_set_keymap('n', '<leader>key1', ':echo "test"<cr>', {noremap = true})
vim.keymap.set('n', '<leader>key2', ':echo "test"<cr>')
-vim.api.nvim_exec("augroup test_group\
+vim.api.nvim_exec2("augroup test_group\
autocmd!\
autocmd FileType c setl cindent\
augroup END\
- ", false)
+ ", {})
vim.api.nvim_command("command Bdelete :bd")
vim.api.nvim_create_user_command("TestCommand", ":echo 'Hello'", {})
@@ -46,7 +46,7 @@ endfunction\
let &tw = s:return80()\
", true)
]])
- exec(':source '..script_file)
+ exec(cmd .. ' ' .. script_file)
end)
teardown(function()
@@ -106,6 +106,9 @@ test_group FileType
end)
it('"Last set" for command defined by nvim_command', function()
+ if cmd == 'luafile' then
+ pending('nvim_command does not set the script context')
+ end
local result = exec_capture(':verbose command Bdelete')
eq(string.format([[
Name Args Address Complete Definition
@@ -123,7 +126,7 @@ test_group FileType
script_location), result)
end)
- it('"Last set for function', function()
+ it('"Last set" for function', function()
local result = exec_capture(':verbose function Close_Window')
eq(string.format([[
function Close_Window() abort
@@ -140,6 +143,14 @@ test_group FileType
Last set from %s line 22]],
script_location), result)
end)
+end
+
+describe('lua :verbose when using :source', function()
+ last_set_tests('source')
+end)
+
+describe('lua :verbose when using :luafile', function()
+ last_set_tests('luafile')
end)
describe('lua verbose:', function()
@@ -149,7 +160,7 @@ describe('lua verbose:', function()
clear()
script_file = 'test_luafile.lua'
write_file(script_file, [[
- vim.api.nvim_set_option('hlsearch', false)
+ vim.api.nvim_set_option_value('hlsearch', false, {})
]])
exec(':source '..script_file)
end)