Skip to content

Commit

Permalink
fix: include sub-test in test output
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Jul 14, 2024
1 parent c068d37 commit 579c8d5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lua/neotest-golang/process.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ function M.decorate_with_go_package_and_test_name(
return res
end

function M.starts_with(str, start)
vim.notify(
"str: " .. vim.inspect(str) .. " and start: " .. vim.inspect(start)
)
return str:sub(1, #start) == start
end

--- Decorate the internal test result data with data from the 'go test' output.
--- @param res table<string, TestData>
--- @param gotest_output table
Expand All @@ -259,8 +266,10 @@ function M.decorate_with_go_test_results(res, gotest_output)
for pos_id, test_data in pairs(res) do
for _, line in ipairs(gotest_output) do
if
test_data.gotest_data.pkg == line.Package
and test_data.gotest_data.name == line.Test
line.Package ~= nil
and line.Test ~= nil
and line.Package == test_data.gotest_data.pkg
and M.starts_with(line.Test, test_data.gotest_data.name)
then
-- record test status
if line.Action == "pass" then
Expand Down

0 comments on commit 579c8d5

Please sign in to comment.