Sha256: 0f6f35817744aa4a80b6219a9f26e01aa32a74b25f48c3ec5c03fde219954c00

Contents?: true

Size: 1.37 KB

Versions: 24

Compression:

Stored size: 1.37 KB

Contents

#!/usr/local/bin/ruby -w

# string_methods.rb
#
#  Created by Richard LeBer 2011-06-27
#
#  This is Free Software.  See LICENSE and COPYING for details.
#
#  String class convenience methods

module StringMethods  
  def test_color
    assert_equal("\e[34mstring\e[0m", @string.color(:blue))
    assert_equal("\e[1m\e[47mstring\e[0m", @string.color(:bold,:on_white))
    assert_equal("\e[45mstring\e[0m", @string.on(:magenta))
    assert_equal("\e[36mstring\e[0m", @string.cyan)
    assert_equal("\e[41m\e[5mstring\e[0m\e[0m", @string.blink.on_red)
    assert_equal("\e[38;5;137mstring\e[0m", @string.color(:rgb_906030))
    assert_equal("\e[38;5;101mstring\e[0m", @string.rgb('606030'))
    assert_equal("\e[38;5;107mstring\e[0m", @string.rgb('60','90','30'))
    assert_equal("\e[38;5;107mstring\e[0m", @string.rgb(96,144,48))
    assert_equal("\e[38;5;173mstring\e[0m", @string.rgb_c06030)
    assert_equal("\e[48;5;137mstring\e[0m", @string.color(:on_rgb_906030))
    assert_equal("\e[48;5;101mstring\e[0m", @string.on_rgb('606030'))
    assert_equal("\e[48;5;107mstring\e[0m", @string.on_rgb('60','90','30'))
    assert_equal("\e[48;5;107mstring\e[0m", @string.on_rgb(96,144,48))
    assert_equal("\e[48;5;173mstring\e[0m", @string.on_rgb_c06030)
  end
  
  def test_uncolor
    colored_string = HighLine::String("\e[38;5;137mstring\e[0m")
    assert_equal "string", colored_string.uncolor
  end
end

Version data entries

24 entries across 21 versions & 4 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/highline-1.6.12/test/string_methods.rb
challah-0.6.2 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.6.1 vendor/bundle/gems/highline-1.6.12/test/string_methods.rb
challah-0.6.1 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.6.0 vendor/bundle/gems/highline-1.6.12/test/string_methods.rb
challah-0.6.0 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
highline-1.6.12 test/string_methods.rb
challah-0.5.4 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.5.3 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.5.2 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.5.1 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/highline-1.6.11/test/string_methods.rb
challah-0.5.0 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.4.1 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.4.0 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
challah-0.3.5 vendor/bundle/gems/highline-1.6.11/test/string_methods.rb
domo-0.0.5 vendor/bundle/ruby/1.9.1/gems/highline-1.6.11/test/string_methods.rb
highline-1.6.11 test/string_methods.rb
highline-1.6.10 test/string_methods.rb
highline-1.6.9 test/string_methods.rb