Skip to content

Commit 7893772

Browse files
author
BirdeeHub
committed
ci(tests): write to io.stdout instead of print
to ensure it shows icons in nix output
1 parent b4fe62a commit 7893772

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/gambiarra.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ return setmetatable({
6161
gambiarrahandler = function(self, e, desc, msg, err)
6262
local suffix = tostring(msg) .. (err and "\n (with error: " .. err .. ")" or "")
6363
if e == 'pass' then
64-
print(" [32m✔[0m " .. suffix)
64+
io.stdout:write(" [32m✔[0m " .. suffix .. "\n")
6565
self.tests_passed = self.tests_passed + 1
6666
elseif e == 'fail' then
67-
print(" [31m✘[0m " .. suffix)
67+
io.stdout:write(" [31m✘[0m " .. suffix .. "\n")
6868
self.tests_failed = self.tests_failed + 1
6969
elseif e == 'except' then
70-
print(" [35m‼[0m " .. suffix)
70+
io.stdout:write(" [35m‼[0m " .. suffix .. "\n")
7171
self.tests_failed = self.tests_failed + 1
7272
elseif e == 'begin' then
73-
print(" [36m▶[0m " .. desc)
73+
io.stdout:write(" [36m▶[0m " .. desc .. "\n")
7474
elseif e == 'end' then
7575
end
7676
end,
@@ -83,9 +83,9 @@ return setmetatable({
8383
end
8484
elseif key == 'report' then
8585
return function()
86-
print("Tests ran: " .. tostring(self.tests_failed or 0) + tostring(self.tests_passed or 0))
87-
print("Tests passed: " .. tostring(self.tests_passed))
88-
print("Tests failed: " .. tostring(self.tests_failed))
86+
io.stdout:write("Tests ran: " .. tostring(self.tests_failed or 0) + tostring(self.tests_passed or 0) .. "\n")
87+
io.stdout:write("Tests passed: " .. tostring(self.tests_passed) .. "\n")
88+
io.stdout:write("Tests failed: " .. tostring(self.tests_failed) .. "\n")
8989
end
9090
elseif key == 'assert_passing' then
9191
return function()

0 commit comments

Comments
 (0)