diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-03-11 21:09:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-11 21:09:11 +0800 |
commit | 6d0c61d90d316473eee0729363e20bf06825b09b (patch) | |
tree | 0fcae1948517bf620bd4f90f2009a896ebfb637e /test | |
parent | 8065fc9aaeff734f38109aec52bf852379a5a183 (diff) | |
download | rneovim-6d0c61d90d316473eee0729363e20bf06825b09b.tar.gz rneovim-6d0c61d90d316473eee0729363e20bf06825b09b.tar.bz2 rneovim-6d0c61d90d316473eee0729363e20bf06825b09b.zip |
fix(api): set script context when setting usercmd or option (#22624)
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/vim_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/ex_cmds/verbose_spec.lua | 17 |
2 files changed, 32 insertions, 3 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 08abf82f47..48ac491ade 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -2832,6 +2832,24 @@ describe('API', function() type = "boolean", was_set = true }, meths.get_option_info'showcmd') + + meths.set_option_value('showcmd', true, {}) + + eq({ + allows_duplicates = true, + commalist = false, + default = true, + flaglist = false, + global_local = false, + last_set_chan = 1, + last_set_linenr = 0, + last_set_sid = -9, + name = "showcmd", + scope = "global", + shortname = "sc", + type = "boolean", + was_set = true + }, meths.get_option_info'showcmd') end) end) diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua index 000e746f1c..e55372e993 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() @@ -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() |