summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/overseer/template/custom/cmake_test.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/overseer/template/custom/cmake_test.lua')
-rw-r--r--.config/nvim/lua/overseer/template/custom/cmake_test.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/.config/nvim/lua/overseer/template/custom/cmake_test.lua b/.config/nvim/lua/overseer/template/custom/cmake_test.lua
new file mode 100644
index 0000000..7591cc9
--- /dev/null
+++ b/.config/nvim/lua/overseer/template/custom/cmake_test.lua
@@ -0,0 +1,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,
+ },
+}