forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_panel.lua
More file actions
49 lines (40 loc) · 1.22 KB
/
Copy pathtest_panel.lua
File metadata and controls
49 lines (40 loc) · 1.22 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
local eq = MiniTest.expect.equality
local child_helper = require("tests.child_helper")
local child = child_helper.new_child_neovim("test_client")
local T = MiniTest.new_set({
hooks = {
pre_once = function() end,
pre_case = function()
child.run_pre_case()
child.bo.readonly = false
child.lua("p = require('copilot.panel')")
end,
post_once = child.stop,
},
})
T["panel()"] = MiniTest.new_set()
T["panel()"]["panel suggestions works"] = function()
child.o.lines, child.o.columns = 30, 100
child.config.panel = child.config.panel .. "auto_refresh = true,"
child.config.suggestion = child.config.suggestion .. "auto_trigger = true,"
child.configure_copilot()
child.type_keys("i123", "<Esc>", "o456", "<Esc>", "o7")
child.lua("p.toggle()")
local lines = child.lua([[
local messages = ""
local function suggestion_is_visible()
lines = vim.api.nvim_buf_get_lines(2, 4, 5, false)
return lines[1] == "789" or lines[1] == "789\r"
end
vim.wait(30000, function()
return suggestion_is_visible()
end, 50)
return lines
]])
-- For Windows, on some shells not all
if lines[1] == "789\r" then
lines[1] = "789"
end
eq(lines[1], "789")
end
return T