lib/rgot/t.rb in rgot-1.1.0 vs lib/rgot/t.rb in rgot-1.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Rgot
class T < Common
def initialize(test_module, name)
super()
@module = test_module
@@ -8,25 +10,27 @@
end
def run
catch(:skip) { call }
finish!
+ report
rescue => e
fail!
report
raise e
end
def report
+ puts @output if Rgot.verbose? && !@output.empty?
duration = Rgot.now - @start
- template = "--- %s: %s (%.2fs)\n%s"
+ template = "--- \e[%sm%s\e[m: %s (%.2fs)\n"
if failed?
- printf template, "FAIL", @name, duration, @output
+ printf template, [41, 1].join(';'), "FAIL", @name, duration
elsif Rgot.verbose?
if skipped?
- printf template, "SKIP", @name, duration, @output
+ printf template, [44, 1].join(';'), "SKIP", @name, duration
else
- printf template, "PASS", @name, duration, @output
+ printf template, [42, 1].join(';'), "PASS", @name, duration
end
end
end
def call