fix TSamFailedOnly and the output formatting for the go-runner
This commit is contained in:
@@ -201,6 +201,22 @@ function runner.build_file_command(bufnr)
|
||||
local spec = { file = path, cwd = root }
|
||||
local pkg = build_pkg_arg(spec)
|
||||
local cmd = { "go", "test", "-json", pkg }
|
||||
local lines = util.get_buf_lines(bufnr)
|
||||
local funcs = find_test_functions(lines)
|
||||
local names = {}
|
||||
for _, fn in ipairs(funcs) do
|
||||
table.insert(names, fn.name)
|
||||
end
|
||||
names = collect_unique(names)
|
||||
if #names > 0 then
|
||||
local pattern_parts = {}
|
||||
for _, name in ipairs(names) do
|
||||
table.insert(pattern_parts, escape_go_regex(name))
|
||||
end
|
||||
local pattern = "^(" .. table.concat(pattern_parts, "|") .. ")$"
|
||||
table.insert(cmd, "-run")
|
||||
table.insert(cmd, pattern)
|
||||
end
|
||||
return {
|
||||
cmd = cmd,
|
||||
cwd = root,
|
||||
|
||||
Reference in New Issue
Block a user