diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-02-17 14:07:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-17 14:07:42 +0100 |
commit | f4e24f1eabfac439ac09d9646582f682c02cfe3f (patch) | |
tree | 7c1366ec089ff70035fb8ad948492b15ec60f8b0 /test | |
parent | 3230b314862e50899d68b3944134cbffaa797cde (diff) | |
parent | dc24eeb9febaa331e660e14c3c325fd0977b6b93 (diff) | |
download | rneovim-f4e24f1eabfac439ac09d9646582f682c02cfe3f.tar.gz rneovim-f4e24f1eabfac439ac09d9646582f682c02cfe3f.tar.bz2 rneovim-f4e24f1eabfac439ac09d9646582f682c02cfe3f.zip |
Merge pull request #17421 from lewis6991/hl0_clear
fix(highlight): global ns improvements
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/highlight_spec.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index 46a3798dc4..416945f379 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -276,4 +276,43 @@ describe("API: set highlight", function() eq('Test_hl3 xxx guifg=bLue guibg=reD', exec_capture('highlight Test_hl3')) end) + + it ("can modify a highlight in the global namespace", function() + meths.set_hl(0, 'Test_hl3', { bg = 'red', fg = 'blue'}) + eq('Test_hl3 xxx guifg=blue guibg=red', + exec_capture('highlight Test_hl3')) + + meths.set_hl(0, 'Test_hl3', { bg = 'red' }) + eq('Test_hl3 xxx guibg=red', + exec_capture('highlight Test_hl3')) + + meths.set_hl(0, 'Test_hl3', { ctermbg = 9, ctermfg = 12}) + eq('Test_hl3 xxx ctermfg=12 ctermbg=9', + exec_capture('highlight Test_hl3')) + + meths.set_hl(0, 'Test_hl3', { ctermbg = 'red' , ctermfg = 'blue'}) + eq('Test_hl3 xxx ctermfg=12 ctermbg=9', + exec_capture('highlight Test_hl3')) + + meths.set_hl(0, 'Test_hl3', { ctermbg = 9 }) + eq('Test_hl3 xxx ctermbg=9', + exec_capture('highlight Test_hl3')) + + meths.set_hl(0, 'Test_hl3', {}) + eq('Test_hl3 xxx cleared', + exec_capture('highlight Test_hl3')) + + eq("'redd' is not a valid color", + pcall_err(meths.set_hl, 0, 'Test_hl3', {fg='redd'})) + + eq("'bleu' is not a valid color", + pcall_err(meths.set_hl, 0, 'Test_hl3', {ctermfg='bleu'})) + + meths.set_hl(0, 'Test_hl3', {fg='#FF00FF'}) + eq('Test_hl3 xxx guifg=#FF00FF', + exec_capture('highlight Test_hl3')) + + eq("'#FF00FF' is not a valid color", + pcall_err(meths.set_hl, 0, 'Test_hl3', {ctermfg='#FF00FF'})) + end) end) |