Skip to content

Commit

Permalink
append -> prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
S-S-X committed Aug 6, 2023
1 parent 196a6d5 commit 3efd527
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
18 changes: 11 additions & 7 deletions bin/mineunit
Original file line number Diff line number Diff line change
Expand Up @@ -484,20 +484,24 @@ if args.output == "utfTerminal" and not args.quiet then
first_end = true
end)
busted.subscribe({'test', 'end'}, function(element, parent, status)
local space = ''
if not skip_quiet and first_end then
first_end = false
io.stdout:write(' ')
space = ' '
end
if status == 'pending' then
io.stdout:write(c.yellow(''))
io.stdout:write(space..c.yellow(''))
mineunit:prepend_print('\n')
elseif status == 'failure' then
io.stdout:write(c.red(''))
io.stdout:write(space..c.red(''))
mineunit:prepend_print('\n')
elseif status == 'error' then
io.stdout:write(c.magenta(''))
else
io.stdout:write(c.green(''))
io.stdout:write(space..c.magenta(''))
mineunit:prepend_print('\n')
elseif not skip_quiet then
io.stdout:write(space..c.green(''))
mineunit:prepend_print('\n')
end
mineunit:prepend_print('\n')
end)
end

Expand Down
8 changes: 4 additions & 4 deletions print.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
local luaprint = _G.print

function mineunit:prepend_print(s)
self._append_output = s
self._prepend_output = s
end

function mineunit:prepend_flush()
if self._append_output then
io.stdout:write(self._append_output)
self._append_output = nil
if self._prepend_output then
io.stdout:write(self._prepend_output)
self._prepend_output = nil
end
end

Expand Down

0 comments on commit 3efd527

Please sign in to comment.