Permalink
Browse files

test for color plugin

  • Loading branch information...
1 parent e221683 commit f5d6535766721f8ee1cbb11399ce555d5f8386c2 @godfat committed Jun 16, 2011
Showing with 21 additions and 1 deletion.
  1. +1 −0 lib/ripl/rc/color.rb
  2. +3 −1 ripl-rc.gemspec
  3. +17 −0 test/test_color.rb.rb
View
@@ -4,6 +4,7 @@
module Ripl::Rc::Color
include Ripl::Rc::U
+ module_function
def format_result result, display=result.inspect
return super(result) if Color.disabled?
case result
View
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = [%q{Lin Jen-Shin (godfat)}]
- s.date = %q{2011-06-16}
+ s.date = %q{2011-06-17}
s.description = %q{ripl plugins collection, take you want, leave you don't.}
s.email = [%q{godfat (XD) godfat.org}]
s.executables = [%q{ripl-rc}]
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
%q{ripl-rc.gemspec},
%q{screenshot.png},
%q{task/gemgem.rb},
+ %q{test/test_color.rb.rb},
%q{test/test_disable_shortcut.rb},
%q{test/test_ensure_after_loop.rb},
%q{test/test_squeeze_history.rb}]
@@ -61,6 +62,7 @@ Gem::Specification.new do |s|
s.rubygems_version = %q{1.8.5}
s.summary = %q{ripl plugins collection, take you want, leave you don't.}
s.test_files = [
+ %q{test/test_color.rb.rb},
%q{test/test_disable_shortcut.rb},
%q{test/test_ensure_after_loop.rb},
%q{test/test_squeeze_history.rb}]
View
@@ -0,0 +1,17 @@
+
+require 'ripl/rc/test'
+require 'ripl/rc/color'
+
+describe Ripl::Rc::Color do
+ should 'give correct color' do
+ Ripl::Rc::Color.format_result(
+ [{0 => :a}, 'b', [nil, {false => Object}], {true => Exception.new}]).
+ should ==
+ "\e[34m[\e[m\e[34m{\e[m\e[31m0\e[m\e[34m=>\e[m\e[36m:a\e[m\e[" \
+ "34m}\e[m\e[34m, \e[m\e[32m\"b\"\e[m\e[34m, \e[m\e[34m[\e[m\e" \
+ "[35mnil\e[m\e[34m, \e[m\e[34m{\e[m\e[35mfalse\e[m\e[34m=>\e[" \
+ "m\e[33mObject\e[m\e[34m}\e[m\e[34m]\e[m\e[34m, \e[m\e[34m{\e" \
+ "[m\e[35mtrue\e[m\e[34m=>\e[m\e[35m#<Exception: Exception>\e[" \
+ "m\e[34m}\e[m\e[34m]\e[m"
+ end
+end

0 comments on commit f5d6535

Please sign in to comment.