Sha256: 50aa2813632b04d616abdd561e0548d568b0a32148796d531a35b05ab61da941

Contents?: true

Size: 1.23 KB

Versions: 28

Compression:

Stored size: 1.23 KB

Contents

require File.dirname(__FILE__)+'/test_helper'

class ColorsTest < Test::Unit::TestCase
  context "colors" do
    setup do
      @data = [
        "<red bg=blue>Red text on blue background</red>",
        "<red>Red text</red>",
        "<blue bg=yellow>Blue text on yellow bg</blue>",
        "<b>BOLD</b>",
        "<blue>Blue</blue>, <red>red</red> and <yellow>BOLD</yellow>",
        "<purple bg=red>Purple is covered</purple> <blue>too!</blue>"
      ]      
    end

    should "substitute tags for each line" do
      assert_equal "\e[1m\e[44m\e[1m\e[31mRed text on blue background\e[0m\e[37m\e[40m\e[0m\e[37m\e[40m", Colors.process(@data[0])
      assert_equal "\e[1m\e[31mRed text\e[0m\e[37m\e[40m", Colors.process(@data[1])
      assert_equal "\e[1m\e[43m\e[1m\e[34mBlue text on yellow bg\e[0m\e[37m\e[40m\e[0m\e[37m\e[40m", Colors.process(@data[2])
      assert_equal "\e[1mBOLD\e[0m\e[37m\e[40m", Colors.process(@data[3])
      assert_equal "\e[1m\e[34mBlue\e[0m\e[37m\e[40m, \e[1m\e[31mred\e[0m\e[37m\e[40m and \e[1m\e[33mBOLD\e[0m\e[37m\e[40m", Colors.process(@data[4])
      assert_equal "\e[1m\e[41m\e[1m\e[35mPurple is covered\e[0m\e[37m\e[40m\e[0m\e[37m\e[40m \e[1m\e[34mtoo!\e[0m\e[37m\e[40m", Colors.process(@data[5])
    end
  end
  
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.1 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.10 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.11 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.12 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.13 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.14 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.15 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.16 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.17 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.2 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.3 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.4 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.5 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.6 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.7 vendor/gems/colors/test/colors_test.rb
auser-poolparty-1.3.8 vendor/gems/colors/test/colors_test.rb
fairchild-poolparty-1.3.17 vendor/gems/colors/test/colors_test.rb
fairchild-poolparty-1.3.5 vendor/gems/colors/test/colors_test.rb
poolparty-1.3.15 vendor/gems/colors/test/colors_test.rb