print exception for tests (if occur or -v)

This commit is contained in:
Denis Knauf 2021-12-09 14:11:45 +01:00
parent ec025652c9
commit 7078305256

View file

@ -41,6 +41,11 @@ class Capture
STDERR.printf "[% 4d] \e[1;31mer\e[0m %s tests %s\e[J\n", @counter, $0.shellescape, command.shelljoin STDERR.printf "[% 4d] \e[1;31mer\e[0m %s tests %s\e[J\n", @counter, $0.shellescape, command.shelljoin
end end
def logexception prefix, exception
loginfo "#{prefix} (#{exception.class.name}) #{exception}"
exception.backtrace[0...-Kernel.caller.length].each {|l| loginfo " #{l}" }
end
def loginfo text def loginfo text
STDERR.printf " %s\n", text STDERR.printf " %s\n", text
end end
@ -64,7 +69,7 @@ class Capture
end end
rescue Object rescue Object
logfail command logfail command
loginfo "unexpected raise: (#{$!.class.name}) #$!" logexception "unexpected raise:", $!
STDERR.puts STDERR.puts
end end
@ -76,16 +81,16 @@ class Capture
if message === $!.message if message === $!.message
logok command logok command
if @verbose if @verbose
loginfo "raised: (#{$!.class.name}) #$!" logexception "raised:", $!
STDERR.puts STDERR.puts
end end
else else
loginfo "unexpected message: (#{$!.class.name}) #$!" logexception "unexpected message:", $!
STDERR.puts STDERR.puts
end end
rescue Object rescue Object
logfail command logfail command
loginfo "unexpected raised: (#{$!.class.name}) #$!" logexception "unexpected raised:", $!
STDERR.puts STDERR.puts
end end
end end