Sha256: a3e8ff12d5fb51da96a70780a5c8393d76e3c624fc1cf1dd1d0169dffd3e41c8

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + '/../lib/rainbow')

class RainbowTest < Test::Unit::TestCase #:nodoc:
  def test_color
    assert_equal "\e[31mhello\e[0m", "hello".color(:red)
  end
  
  def test_foreground
    assert_equal "hello".color(:red), "hello".foreground(:red)
  end

  def test_colour_alias
    assert_equal "hello".color(:red), "hello".colour(:red)
  end
  
  def test_background
    assert_equal "\e[42mhello\e[0m", "hello".background(:green)
  end

  def test_color_and_background
    assert_equal "\e[31m\e[42mhello\e[0m", "hello".color(:red).background(:green)
  end

  def test_bright
    assert_equal "\e[1mhello\e[0m", "hello".bright
  end

  def test_bright_and_color
    assert_equal "\e[1m\e[31mhello\e[0m", "hello".bright.color(:red)
  end

  def test_bright_and_background
    assert_equal "\e[1m\e[44mhello\e[0m", "hello".bright.background(:blue)
  end

  def test_color_override
    assert_equal "\e[31m\e[34m\e[33mhello\e[0m", "hello".color(:red).color(:blue).color(:yellow)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rainbow-1.0.3 test/rainbow_test.rb
rainbow-1.0 test/rainbow_test.rb
rainbow-1.0.1 test/rainbow_test.rb
rainbow-1.0.2 test/rainbow_test.rb