diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-04-13 14:39:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 14:39:12 +0200 |
commit | b85ac89326d11461de4d40d6e317d154ee6a0d2c (patch) | |
tree | 82f4b4bb944c0ac94668e7d99a0892955bb034bc /test/functional/api/highlight_spec.lua | |
parent | c8c7912a4deed6351e77b42d42742d675f5d45c6 (diff) | |
parent | d05d63a18ff8394b31b3f3b85bfaebe2af358437 (diff) | |
download | rneovim-b85ac89326d11461de4d40d6e317d154ee6a0d2c.tar.gz rneovim-b85ac89326d11461de4d40d6e317d154ee6a0d2c.tar.bz2 rneovim-b85ac89326d11461de4d40d6e317d154ee6a0d2c.zip |
Merge pull request #23064 from bfredl/nolink
fix(api): make nvim_get_hl not return non-existing groups
Diffstat (limited to 'test/functional/api/highlight_spec.lua')
-rw-r--r-- | test/functional/api/highlight_spec.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index a4bd574a56..a6e9f9a42b 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -575,4 +575,25 @@ describe('API: get highlight', function() meths.set_hl(0, 'Foo', hl) eq(hl, meths.get_hl(0, { name = 'Foo', link = true })) end) + + it("doesn't contain unset groups", function() + local id = meths.get_hl_id_by_name "@foobar.hubbabubba" + ok(id > 0) + + local data = meths.get_hl(0, {}) + eq(nil, data["@foobar.hubbabubba"]) + eq(nil, data["@foobar"]) + + command 'hi @foobar.hubbabubba gui=bold' + data = meths.get_hl(0, {}) + eq({bold = true}, data["@foobar.hubbabubba"]) + eq(nil, data["@foobar"]) + + -- @foobar.hubbabubba was explicitly cleared and thus shows up + -- but @foobar was never touched, and thus doesn't + command 'hi clear @foobar.hubbabubba' + data = meths.get_hl(0, {}) + eq({}, data["@foobar.hubbabubba"]) + eq(nil, data["@foobar"]) + end) end) |