aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/highlight_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-02-15 23:40:06 +0000
committerLewis Russell <lewis6991@gmail.com>2022-02-16 20:22:09 +0000
commit876aaf2003d1a6eb8f0701cf11e1834751b28980 (patch)
tree7a5fb69585707ef94bf0c9eedcafbcad65cc980b /test/functional/api/highlight_spec.lua
parent238b944e58d12a28245be996e69bf36a2a452a90 (diff)
downloadrneovim-876aaf2003d1a6eb8f0701cf11e1834751b28980.tar.gz
rneovim-876aaf2003d1a6eb8f0701cf11e1834751b28980.tar.bz2
rneovim-876aaf2003d1a6eb8f0701cf11e1834751b28980.zip
fix(highlight): allow globals to be cleared
- and reduce heap allocations Fixes #17420
Diffstat (limited to 'test/functional/api/highlight_spec.lua')
-rw-r--r--test/functional/api/highlight_spec.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 46a3798dc4..a412a236a7 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -276,4 +276,26 @@ 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 = 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'))
+ end)
end)