extend simple test listing to a list-detail-view window
This commit is contained in:
@@ -275,6 +275,36 @@ function runner.parse_results(output)
|
||||
}
|
||||
end
|
||||
|
||||
local function split_output_lines(text)
|
||||
if not text or text == "" then
|
||||
return {}
|
||||
end
|
||||
local lines = vim.split(text, "\n", { plain = true })
|
||||
if #lines > 0 and lines[#lines] == "" then
|
||||
table.remove(lines, #lines)
|
||||
end
|
||||
return lines
|
||||
end
|
||||
|
||||
function runner.parse_test_output(output)
|
||||
local out = {}
|
||||
if not output or output == "" then
|
||||
return out
|
||||
end
|
||||
for line in output:gmatch("[^\n]+") do
|
||||
local ok, data = pcall(vim.json.decode, line)
|
||||
if ok and type(data) == "table" and data.Action == "output" and data.Test and data.Output then
|
||||
if not out[data.Test] then
|
||||
out[data.Test] = {}
|
||||
end
|
||||
for _, item in ipairs(split_output_lines(data.Output)) do
|
||||
table.insert(out[data.Test], item)
|
||||
end
|
||||
end
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
function runner.output_parser()
|
||||
local seen_pass = {}
|
||||
local seen_fail = {}
|
||||
|
||||
Reference in New Issue
Block a user