From daf6c6a091d564931a2c8d49ae7be6d237266738 Mon Sep 17 00:00:00 2001 From: "Shigeto R. Nishitani" Date: Fri, 4 Oct 2019 15:39:52 +0900 Subject: [PATCH 1/2] add colorize --- lib/testrocket.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/testrocket.rb b/lib/testrocket.rb index 7518be0..5c55bc8 100644 --- a/lib/testrocket.rb +++ b/lib/testrocket.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true - +require 'colorize' ## # TestRocket Module to refine lambdas an use them for lightweight tests # @@ -23,10 +23,10 @@ def _desc; end else def _test(a, b); send((call rescue()) ? a : b) end def _show(r); (TestRocket.out || STDERR) << r + "\n"; r end - def _pass; ' OK' end - def _fail; " FAIL @ #{source_location * ':'}" end - def _pend; "PENDING '#{call}' @ #{source_location * ':'}" end - def _desc; " FIRE '#{call}'!" end + def _pass; ' OK'.green end + def _fail; " FAIL @ #{source_location * ':'}".red end + def _pend; "PENDING '#{call}' @ #{source_location * ':'}".brown end + def _desc; " FIRE '#{call}'!".blue end end def +@; _show _test :_pass, :_fail end @@ -34,4 +34,4 @@ def -@; _show _test :_fail, :_pass end def ~; _show _pend end def !; _show _desc end end -end \ No newline at end of file +end From 5cb0e87dabc33104b74e0b6faf88f95848afc0c4 Mon Sep 17 00:00:00 2001 From: "Shigeto R. Nishitani" Date: Wed, 9 Oct 2019 22:17:45 +0900 Subject: [PATCH 2/2] try to use inheritance, but give up --- lib/testrocket.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/testrocket.rb b/lib/testrocket.rb index 5c55bc8..0b1c5c9 100644 --- a/lib/testrocket.rb +++ b/lib/testrocket.rb @@ -25,7 +25,7 @@ def _test(a, b); send((call rescue()) ? a : b) end def _show(r); (TestRocket.out || STDERR) << r + "\n"; r end def _pass; ' OK'.green end def _fail; " FAIL @ #{source_location * ':'}".red end - def _pend; "PENDING '#{call}' @ #{source_location * ':'}".brown end + def _pend; "PENDING '#{call}' @ #{source_location * ':'}".cyan end def _desc; " FIRE '#{call}'!".blue end end