diff options
author | luukvbaal <luukvbaal@gmail.com> | 2024-11-17 00:36:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-16 15:36:11 -0800 |
commit | 9c718bc2bce53b5be45061bff940f99e50c8bfcb (patch) | |
tree | 15449b558fa4de8d233036d2c624adb249dd82b4 /test/functional/api/vim_spec.lua | |
parent | f85bc41c800d7f5c0256f29aa347a53600a7c8d5 (diff) | |
download | rneovim-9c718bc2bce53b5be45061bff940f99e50c8bfcb.tar.gz rneovim-9c718bc2bce53b5be45061bff940f99e50c8bfcb.tar.bz2 rneovim-9c718bc2bce53b5be45061bff940f99e50c8bfcb.zip |
fix(api): validation, documentation of hl_group #31195
Problem: Documentation for "hl_group" in nvim_buf_set_extmark() is
unclear. "hl_group" in nvim_echo() does not accept
highlight group id.
Solution: Move documentation for highlight group name/id to first
mention of hl_group. Update nvim_echo() to accept highlight
group id.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index c7aa1f48da..3f1e378bc1 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -3582,6 +3582,15 @@ describe('API', function() command('highlight Special guifg=SlateBlue') end) + it('validation', function() + eq("Invalid 'chunk': expected Array, got String", pcall_err(api.nvim_echo, { 'msg' }, 1, {})) + eq( + 'Invalid chunk: expected Array with 1 or 2 Strings', + pcall_err(api.nvim_echo, { { '', '', '' } }, 1, {}) + ) + eq('Invalid hl_group: text highlight', pcall_err(api.nvim_echo, { { '', false } }, 1, {})) + end) + it('should clear cmdline message before echo', function() feed(':call nvim_echo([["msg"]], v:false, {})<CR>') screen:expect { @@ -3606,6 +3615,18 @@ describe('API', function() msg_a{15:msg_b}{16:msg_c} | ]], } + async_meths.nvim_echo({ + { 'msg_d' }, + { 'msg_e', api.nvim_get_hl_id_by_name('Statement') }, + { 'msg_f', api.nvim_get_hl_id_by_name('Special') }, + }, true, {}) + screen:expect { + grid = [[ + ^ | + {1:~ }|*6 + msg_d{15:msg_e}{16:msg_f} | + ]], + } end) it('can show highlighted multiline', function() |