Sha256: 8b23941ff06910dafdc527425a646c8519375bbb1b35c03c15522066dd985d9a

Contents?: true

Size: 385 Bytes

Versions: 3

Compression:

Stored size: 385 Bytes

Contents

require 'test/unit'
require 'ansi/code'

class TestANSICode < Test::Unit::TestCase

  include ANSI::Code

  def test_methods
    str = red + "Hello" + blue + "World"
    out = "\e[31mHello\e[34mWorld"
    assert_equal( out, str )
  end

  def test_blocks
    str = red { "Hello" } + blue { "World" }
    out = "\e[31mHello\e[0m\e[34mWorld\e[0m"
    assert_equal( out, str )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ansi-1.2.2 test/test_ansicode.rb
ansi-1.2.1 test/test_ansicode.rb
ansi-1.2.0 test/test_ansicode.rb