forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_base_to_organize.lua
More file actions
52 lines (44 loc) · 1.45 KB
/
Copy pathtest_base_to_organize.lua
File metadata and controls
52 lines (44 loc) · 1.45 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
52
local eq = MiniTest.expect.equality
-- local neq = MiniTest.expect.no_equality
-- local u = require("tests.utils")
local expect_error = MiniTest.expect.error
local child = MiniTest.new_child_neovim()
local T = MiniTest.new_set({
hooks = {
pre_case = function()
-- Restart child process with custom 'init.lua' script
child.restart({ "-u", "tests/scripts/minimal_init.lua" })
child.lua([[M = require('copilot')]])
child.lua([[c = require('copilot.command')]])
-- child.lua([[c.enable()]])
-- child.lua([[c.attach({ force = true })]])
-- child.lua([[conf = require('copilot.config')]])
child.lua([[s = require('copilot.status')]])
end,
-- Stop once all test cases are finished
post_once = child.stop,
},
})
local function run_setup()
child.lua([[M.setup({
logger = {
file_log_level = vim.log.levels.TRACE,
file = "./tests/logs/test_example.log",
},
})]])
end
T["lua()"] = MiniTest.new_set()
T["lua()"]["setup not called, copilot.setup_done is false"] = function()
eq(child.lua("return M.setup_done"), false)
end
T["lua()"]["setup called, copilot.setup_done is true"] = function()
run_setup()
eq(child.lua("return M.setup_done"), true)
end
T["lua()"]["Copilot status, not initialized, returns error"] = function()
run_setup()
expect_error(function()
child.cmd(":Copilot status")
end, ".*not initialized.*")
end
return T