-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathtest_highlight.lua
More file actions
51 lines (45 loc) · 1.47 KB
/
Copy pathtest_highlight.lua
File metadata and controls
51 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local eq = MiniTest.expect.equality
local child_helper = require("tests.child_helper")
local child = child_helper.new_child_neovim("test_highlight")
local T = MiniTest.new_set({
hooks = {
pre_once = function() end,
pre_case = function()
child.run_pre_case(true)
child.configure_copilot()
end,
post_once = child.stop,
},
})
T["highlight()"] = MiniTest.new_set()
T["highlight()"]["CopilotSuggestion highlight group exists after setup"] = function()
child.lua("vim.wait(100, function() return false end, 10)")
local result = child.lua([[
local ok, hl = pcall(vim.api.nvim_get_hl, 0, { name = "CopilotSuggestion" })
return ok and not vim.tbl_isempty(hl)
]])
eq(result, true)
end
T["highlight()"]["CopilotAnnotation highlight group exists after setup"] = function()
child.lua("vim.wait(100, function() return false end, 10)")
local result = child.lua([[
local ok, hl = pcall(vim.api.nvim_get_hl, 0, { name = "CopilotAnnotation" })
return ok and not vim.tbl_isempty(hl)
]])
eq(result, true)
end
T["highlight()"]["does not override existing CopilotSuggestion highlight"] = function()
child.lua([[
vim.api.nvim_set_hl(0, "CopilotSuggestion", { fg = "#ff0000" })
]])
child.lua([[
require("copilot.highlight").setup()
vim.wait(100, function() return false end, 10)
]])
local result = child.lua([[
local hl = vim.api.nvim_get_hl(0, { name = "CopilotSuggestion" })
return hl.fg
]])
eq(result, 0xff0000)
end
return T