diff --git a/tests/test.lua b/tests/test.lua index a3c70e3..4ac51bd 100644 --- a/tests/test.lua +++ b/tests/test.lua @@ -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 end - if pass then return 0 end -- report status to cargo - return 1 + 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()