add TSamFile and TSamAll command with default keymaps

This commit is contained in:
2025-12-23 23:35:40 +01:00
parent 463d0ae2f7
commit 61f9a7dcb4
8 changed files with 281 additions and 41 deletions

View File

@@ -172,4 +172,38 @@ function runner.build_command(spec)
}
end
function runner.build_file_command(bufnr)
local path = util.get_buf_path(bufnr)
if not path or path == "" then
return nil
end
local root = util.find_root(path, { "go.mod", ".git" })
if not root or root == "" then
root = vim.loop.cwd()
end
local spec = { file = path, cwd = root }
local pkg = build_pkg_arg(spec)
local cmd = { "go", "test", "-v", pkg }
return {
cmd = cmd,
cwd = root,
}
end
function runner.build_all_command(bufnr)
local path = util.get_buf_path(bufnr)
local root
if path and path ~= "" then
root = util.find_root(path, { "go.mod", ".git" })
end
if not root or root == "" then
root = vim.loop.cwd()
end
local cmd = { "go", "test", "-v", "./..." }
return {
cmd = cmd,
cwd = root,
}
end
return runner