Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions utils/test/module_store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local function new_module(module_name)
is_open = false,
depth = nil,
count = nil,
pass_count = nil,
passed = nil
}
end
Expand Down
17 changes: 15 additions & 2 deletions utils/test/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ end
local function mark_module_for_passed(module)
local any_fails = false
local all_ran = true
local pass_count = 0
local ran_count = 0

for _, child in pairs(module.children) do
local module_any_fails, module_all_ran = mark_module_for_passed(child)
local module_any_fails, module_all_ran, module_pass_count, module_ran_count = mark_module_for_passed(child)
any_fails = any_fails or module_any_fails
all_ran = all_ran and module_all_ran
pass_count = pass_count + module_pass_count
ran_count = ran_count + module_ran_count
end

for _, test in pairs(module.tests) do
any_fails = any_fails or (test.passed == false)
all_ran = all_ran and (test.passed ~= nil)
if test.passed == true then
pass_count = pass_count + 1
end
if test.passed ~= nil then
ran_count = ran_count + 1
end
end

if any_fails then
Expand All @@ -40,7 +50,10 @@ local function mark_module_for_passed(module)
module.passed = nil
end

return any_fails, all_ran
-- Only show a pass count for modules that have results.
module.pass_count = ran_count > 0 and pass_count or nil

return any_fails, all_ran, pass_count, ran_count
end

local function mark_modules_for_passed()
Expand Down
8 changes: 6 additions & 2 deletions utils/test/viewer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ local function draw_tests_test(container, test, depth)
end

local function draw_tests_module(container, module)
local caption = {module.name or 'All Tests', ' (', module.count, ')'}
caption = table.concat(caption)
local caption
if module.pass_count then
caption = table.concat({module.name or 'All Tests', ' (', module.pass_count, '/', module.count, ')'})
else
caption = table.concat({module.name or 'All Tests', ' (', module.count, ')'})
end

local flow = container.add {type = 'flow'}
local arrow =
Expand Down
Loading