style(base.lua): enhance test summary display

Enhanced the display of test summaries in `base.lua` for better readability and alignment. Increased the width of formatted strings from 60 to 80 characters, providing a more spacious layout for test outputs
This commit is contained in:
Yves-Marie Haussonne 2024-10-04 01:36:49 +02:00
parent 8f77cd456c
commit e8235378d9

View File

@ -427,35 +427,35 @@ end
local display_tests_summary = function()
for mod, tests_list in pairs(tests_by_mod) do
pprint.baby_blue(string.format("%#60s\n", mod))
pprint.baby_blue(string.format("%#80s\n", mod))
for _, test in ipairs(tests_list) do
if test.func == nil then
local s = ":".. test.mod ..":---- " .. test.name
pprint.light_gray(":".. test.mod ..":").blue("---- " .. test.name)
pprint.blue(string.rep("-", 60 - #s).."\n")
pprint.blue(string.rep("-", 80 - #s).."\n")
elseif test.result ~= nil then
local s = ":"..test.mod..":"
local rest = s .. test.name
pprint.light_gray(s)
pprint(" ")
pprint(test.name)
pprint(string.rep(" ", 60 - #rest))
pprint(string.rep(" ", 80 - #rest))
if test.result.ok then pprint.green("pass") else pprint.red("FAIL") end
pprint("\n")
if not test.result.ok and test.result.err then
pprint.yellow(" " .. test.result.err .. "\n")
end
else
pprint.light_gray(string.format(":%s:%-60s %s\n", test.mod, test.name, "No result"))
pprint.light_gray(string.format(":%s:%-80s %s\n", test.mod, test.name, "No result"))
end
end
pprint.baby_blue(string.rep("-",60),"\n")
pprint.baby_blue(string.rep("-",80),"\n")
end
print(string.rep("-",60))
print(string.rep("-",80))
pprint.bold("Tests done, ")
if failed == 0 then pprint.bold.green(failed) else pprint.bold.red(failed) end
pprint.bold(" tests failed.\n")
print(string.rep("-",60))
print(string.rep("-",80))
end
test_harness.dump = function(o)