blob: 7591cc9cb97569d5a011ae826d01a2c8ec5ad987 (
plain)
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
|
local overseer = require('overseer')
local root_pattern = require('lspconfig/util').root_pattern('CMakePresets.json', 'CTestConfig.cmake', 'build', 'cmake')
return {
name = 'Test Cmake Project',
builder = function(_)
local filename = vim.fn.expand('%:p')
local root_dir = root_pattern(filename)
return {
name = 'Cmake Tests',
cmd = 'ctest --output-on-failure',
cwd = root_dir .. '/build',
}
end,
tags = { overseer.TAG.TEST },
priority = 42,
condition = {
callback = function()
local filename = vim.fn.expand('%:p')
local root_dir = root_pattern(filename)
if not root_dir then
return false, 'Unable to detect root directory of cmake project'
end
return true
end,
},
}
|