aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-12-22 13:47:45 +0100
committerGitHub <noreply@github.com>2019-12-22 13:47:45 +0100
commit9e9dcd4bd79cc5ea0fd240bcb242ceea07deabe2 (patch)
treeb4c06d6b6485f364f502b97d8775546a9fced24f /test/functional/api
parente1d63c180cc38cec5a8bf3e543bfe18472352da4 (diff)
parent440695c29696f261337227e5c419aa1cf313c2dd (diff)
downloadrneovim-9e9dcd4bd79cc5ea0fd240bcb242ceea07deabe2.tar.gz
rneovim-9e9dcd4bd79cc5ea0fd240bcb242ceea07deabe2.tar.bz2
rneovim-9e9dcd4bd79cc5ea0fd240bcb242ceea07deabe2.zip
Merge pull request #11113 from bfredl/tree-sitter-query
tree-sitter step 2: query API and highlighting prototype
Diffstat (limited to 'test/functional/api')
-rw-r--r--test/functional/api/highlight_spec.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 5297c6454e..b6514a105c 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -4,6 +4,9 @@ local Screen = require('test.functional.ui.screen')
local eq, eval = helpers.eq, helpers.eval
local command = helpers.command
local meths = helpers.meths
+local funcs = helpers.funcs
+local pcall_err = helpers.pcall_err
+local ok = helpers.ok
describe('API: highlight',function()
local expected_rgb = {
@@ -110,4 +113,20 @@ describe('API: highlight',function()
meths.get_hl_by_name('cursorline', 0));
end)
+
+ it('nvim_get_hl_id_by_name', function()
+ -- precondition: use a hl group that does not yet exist
+ eq('Invalid highlight name: Shrubbery', pcall_err(meths.get_hl_by_name, "Shrubbery", true))
+ eq(0, funcs.hlID("Shrubbery"))
+
+ local hl_id = meths.get_hl_id_by_name("Shrubbery")
+ ok(hl_id > 0)
+ eq(hl_id, funcs.hlID("Shrubbery"))
+
+ command('hi Shrubbery guifg=#888888 guibg=#888888')
+ eq({foreground=tonumber("0x888888"), background=tonumber("0x888888")},
+ meths.get_hl_by_id(hl_id, true))
+ eq({foreground=tonumber("0x888888"), background=tonumber("0x888888")},
+ meths.get_hl_by_name("Shrubbery", true))
+ end)
end)