-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ca7f1cc
Showing
9 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in minitest-colorize.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'bundler/gem_tasks' | ||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new do |t| | ||
t.libs << 'test' | ||
t.pattern = 'test/*_test.rb' | ||
end | ||
|
||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'minitest/colorize' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require "minitest/colorize/version" | ||
|
||
module MiniTest | ||
class Colorize | ||
attr_accessor :io | ||
|
||
def initialize(io) | ||
self.io = io | ||
end | ||
|
||
def print(out) | ||
if color = colors[out] | ||
io.print "#{color}#{out}#{clear}" | ||
else | ||
io.print out | ||
end | ||
end | ||
|
||
def colors | ||
{ "F" => "\e[31m", "E" => "\e[31m", "S" => "\e[33m", "." => "\e[32m" } | ||
end | ||
|
||
def clear | ||
"\e[0m" | ||
end | ||
|
||
def method_missing(method, *args, &block) | ||
io.send(method, *args, &block) | ||
end | ||
end | ||
end | ||
|
||
MiniTest::Unit.output = MiniTest::Colorize.new(MiniTest::Unit.output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module MiniTest | ||
class Colorize | ||
VERSION = "0.0.1" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "minitest/colorize/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "minitest-colorize" | ||
s.version = MiniTest::Colorize::VERSION | ||
s.authors = ["Gabriel Sobrinho"] | ||
s.email = ["gabriel.sobrinho@gmail.com"] | ||
s.homepage = "" | ||
s.summary = %q{Colorize minitest output} | ||
s.description = %q{Colorize minitest output} | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_dependency 'minitest', '~> 2.0' | ||
s.add_development_dependency 'rake', '>= 0.8.7' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'test_helper' | ||
|
||
class MiniTest::ColorizeTest < MiniTest::Unit::TestCase | ||
def test_fail | ||
assert_output "\e[31mF\e[0m" do | ||
colorize = MiniTest::Colorize.new($stdout) | ||
colorize.print 'F' | ||
end | ||
end | ||
|
||
def test_error | ||
assert_output "\e[31mE\e[0m" do | ||
colorize = MiniTest::Colorize.new($stdout) | ||
colorize.print 'E' | ||
end | ||
end | ||
|
||
def test_skip | ||
assert_output "\e[33mS\e[0m" do | ||
colorize = MiniTest::Colorize.new($stdout) | ||
colorize.print 'S' | ||
end | ||
end | ||
|
||
def test_success | ||
assert_output "\e[32m.\e[0m" do | ||
colorize = MiniTest::Colorize.new($stdout) | ||
colorize.print '.' | ||
end | ||
end | ||
|
||
def test_others | ||
assert_output "colorize" do | ||
colorize = MiniTest::Colorize.new($stdout) | ||
colorize.print 'colorize' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'rubygems' | ||
require 'bundler/setup' | ||
require 'minitest/autorun' | ||
require 'minitest-colorize' |