diff options
| author | Francesco Guastella <[email protected]> | 2025-06-25 17:49:14 +0200 |
|---|---|---|
| committer | Francesco Guastella <[email protected]> | 2025-06-25 17:49:14 +0200 |
| commit | f188e3538adbf2981b552db28b486cb196868b2b (patch) | |
| tree | 4dadf33085316262c829e0bf6b0bd859a4cc709a | |
| parent | a54968a5f15b9088461fc7a94b909fbf8cb04340 (diff) | |
Move test summary to the last line of the report
| -rw-r--r-- | xmake/actions/test/main.lua | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua index d5f325cda..b86029b52 100644 --- a/xmake/actions/test/main.lua +++ b/xmake/actions/test/main.lua @@ -398,18 +398,8 @@ function _run_tests(tests) end -- Print the summary - local summary = string.format("\n${color.success}%d%%%%${clear} tests passed, ${color.failure}%d${clear} test(s) failed", passed_rate, #failed_tests) - if #unexpected_passes > 0 then - summary = summary .. string.format(", ${color.failure}%d unexpected pass(es)${clear}", #unexpected_passes) - end - if #expected_failures > 0 then - summary = summary .. string.format(", ${color.warning}%d${clear} expected failure(s)", #expected_failures) - end - - summary = summary .. string.format(" out of ${bright}%d${clear}, spent ${bright}%0.3fs", report.total, spent / 1000) - cprint(summary) if #failed_tests > 0 or #expected_failures > 0 or #unexpected_passes > 0 then - cprint("Detailed summary:") + cprint("\nDetailed summary:") end if #failed_tests > 0 then cprint("${color.failure}Failed tests:${clear}") @@ -432,6 +422,17 @@ function _run_tests(tests) end end + local summary = string.format("\n${color.success}%d%%%%${clear} tests passed, ${color.failure}%d${clear} test(s) failed", passed_rate, #failed_tests) + if #unexpected_passes > 0 then + summary = summary .. string.format(", ${color.failure}%d${clear} unexpected pass(es)", #unexpected_passes) + end + if #expected_failures > 0 then + summary = summary .. string.format(", ${color.warning}%d${clear} expected failure(s)", #expected_failures) + end + + summary = summary .. string.format(" out of ${bright}%d${clear}, spent ${bright}%0.3fs", report.total, spent / 1000) + cprint(summary) + local return_zero = project.policy("test.return_zero_on_failure") if not return_zero and report.passed < report.total then raise() |
