Dear Home Owner, このページをアンテナに追加 RSSフィード

 | 

2006-08-18

Colorize Test::Unit result  Colorize Test::Unit result - Dear Home Owner, を含むブックマーク はてなブックマーク -  Colorize Test::Unit result - Dear Home Owner,  Colorize Test::Unit result - Dear Home Owner, のブックマークコメント

f:id:youpy:20060819011625p:image

require 'test/unit/ui/console/testrunner'
require 'term/ansicolor'
Term::ANSIColor::coloring = STDOUT.tty?
module Test
  module Unit
    module UI
      module Console
        class TestRunner
          include Term::ANSIColor
          def output_single(something, level=NORMAL)
            if output?(level)
              @io.write(send(something == '.' ? 'on_green' : 'on_red', something))
            end
            @io.flush
          end
          def output(something, level=NORMAL)
            if output?(level)
              if something.respond_to?('passed?')
                @io.puts(send(something.passed? ? 'on_green' : 'on_red', something.to_s))
              else
                @io.puts(something)
              end
            end
            @io.flush
          end
        end
      end
    end
  end
end
 |