Report number of passing and failing tests
This commit is contained in:
parent
eb7b05d07a
commit
7c40fb4322
@ -81,18 +81,31 @@ local function start(cx, item)
|
||||
end
|
||||
end
|
||||
|
||||
local function run(item)
|
||||
local function main(item)
|
||||
local cx = { tasks = {} }
|
||||
local pass = true
|
||||
local pass, fail = 0, 0
|
||||
start(cx, item)
|
||||
for _, task in ipairs(cx.tasks) do
|
||||
if task:await().state ~= "pass" then pass = false end
|
||||
if task:await().state == "pass" then
|
||||
pass = pass + 1
|
||||
else
|
||||
fail = fail + 1
|
||||
end
|
||||
if pass then return 0 end -- report status to cargo
|
||||
return 1
|
||||
end
|
||||
if fail == 0 then
|
||||
print("", color("pass", string.format("%d tests passed", pass)))
|
||||
return 0
|
||||
end
|
||||
print(
|
||||
"",
|
||||
color("pass", string.format("%d tests passed", pass))
|
||||
.. ", "
|
||||
.. color("fail", string.format("%d tests failed", fail))
|
||||
)
|
||||
return 1 -- report error to cargo
|
||||
end
|
||||
|
||||
return run(create_group("", function()
|
||||
return main(create_group("", function()
|
||||
local function glob(path, pat)
|
||||
for entry in fs:glob_dir(path, pat) do
|
||||
local path = entry:path()
|
||||
|
Loading…
x
Reference in New Issue
Block a user