From 3efd527c9e04ff6cdb6e35c44d2c0cadbc8587c6 Mon Sep 17 00:00:00 2001 From: SX <50966843+S-S-X@users.noreply.github.com> Date: Sun, 6 Aug 2023 13:00:24 +0300 Subject: [PATCH] append -> prepend --- bin/mineunit | 18 +++++++++++------- print.lua | 8 ++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/bin/mineunit b/bin/mineunit index 57071d7..84530b4 100755 --- a/bin/mineunit +++ b/bin/mineunit @@ -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 diff --git a/print.lua b/print.lua index d970af5..408dc83 100644 --- a/print.lua +++ b/print.lua @@ -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