Sha256: 4f9894540d93dbf768b09d722e8c31b074403e64223292ffb50d84818b967e99

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

$VERBOSE = true

require 'rubygems'
require 'minitest/autorun'

class TestColoredNot < MiniTest::Unit::TestCase
  def test_colored_not
    assert_raises(LoadError) do
      require 'colored/not'
    end

    require 'colored'
    require 'colored/not'

    3.times do
      assert_equal "\e[31mred\e[0m", 'red'.red
      assert_equal "\e[41mred\e[0m", 'red'.on_red
      assert_equal "\e[31m\e[44mred\e[0m", 'red'.red_on_blue
      assert_equal "\e[1mred\e[0m", 'red'.bold
      assert_equal "\e[4m\e[44m\e[31mred\e[0m\e[0m\e[0m", 'red'.red.on_blue.underline
      assert_equal "", 'red'.clear if 'red'.respond_to?(:clear)

      nots = Colored.not!

      assert_equal "red", 'red'.red
      assert_equal "red", 'red'.on_red
      assert_equal "red", 'red'.red_on_blue
      assert_equal "red", 'red'.bold
      assert_equal "red", 'red'.red.on_blue.underline
      assert_equal "", 'red'.clear if 'red'.respond_to?(:clear)

      cols = Colored!

      assert nots.include?(:bold)
      assert nots.include?(:red)
      assert nots.include?(:on_red)
      assert nots.include?(:red_on_blue)
      assert !nots.include?(:red_on_red)
      assert (nots - cols).empty?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
colored-not-1.2.1 test/test_colored-not.rb