Sha256: 3f48c5b62dd54f1e087414fcdbb784a90e9cafca4930874fa8e2135c2bfbb97c

Contents?: true

Size: 1.11 KB

Versions: 100

Compression:

Stored size: 1.11 KB

Contents

require 'test_helper'
require 'ansi/bbcode'

testcase ANSI::BBCode do

  class_method :bbcode_to_ansi do
    test do
      str = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
      out = "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
      out.assert == ANSI::BBCode.bbcode_to_ansi(str)
    end
  end

  class_method :bbcode_to_html do
    test do
      str = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
      out = "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
      out.assert == ANSI::BBCode.bbcode_to_html(str)
    end
  end

  class_method :ansi_to_html do
    test do
      str = "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n" +
            "this is a line without any ansi code\n" +
            "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
      out = "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n" +
            "this is a line without any ansi code<br />\n" +
            "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
      out.assert == ANSI::BBCode.ansi_to_html(str)
    end
  end

end

Version data entries

100 entries across 58 versions & 17 rubygems

Version Path
chikari_palindrome-0.1.0 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/test/case_bbcode.rb
chikari_palindrome-0.1.0 vendor/cache/ruby/2.7.0/gems/chikari_palindrome-0.1.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/test/case_bbcode.rb
hirohig_palindrome-0.2.0 vendor/bundle/ruby/2.6.0/gems/ansi-1.5.0/test/case_bbcode.rb
hirohig_palindrome-0.1.0 vendor/bundle/ruby/2.6.0/gems/ansi-1.5.0/test/case_bbcode.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/ansi-1.5.0/test/case_bbcode.rb
cspeezy_palindrome-0.3.0 path/ruby/2.6.0/gems/ansi-1.5.0/test/case_bbcode.rb
cspeezy_palindrome-0.2.0 path/ruby/2.6.0/gems/ansi-1.5.0/test/case_bbcode.rb
cspeezy_palindrome-0.1.0 path/ruby/2.6.0/gems/ansi-1.5.0/test/case_bbcode.rb
steenfest_palindrome-0.1.2 ruby/2.5/gems/ansi-1.5.0/test/case_bbcode.rb
steenfest_palindrome-0.1.1b ruby/2.5/gems/ansi-1.5.0/test/case_bbcode.rb
nullifyable-0.1.0 vendor/bundle/gems/ansi-1.5.0/test/case_bbcode.rb
dmurphy_palindrome-0.1.0 vendor/cache/ruby/2.3.0/gems/dmurphy_palindrome-0.1.0/vendor/cache/ruby/2.3.0/gems/ansi-1.5.0/test/case_bbcode.rb
dmurphy_palindrome-0.1.0 vendor/cache/ruby/2.3.0/gems/ansi-1.5.0/test/case_bbcode.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/ansi-1.5.0/test/case_bbcode.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/lgrgic_palindrome_detector-0.1.0/vendor/cache/gems/ansi-1.5.0/test/case_bbcode.rb
lgrgic_palindrome_detector-0.1.0 vendor/cache/gems/ansi-1.5.0/test/case_bbcode.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/ansi-1.5.0/test/case_bbcode.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/ansi-1.5.0/test/case_bbcode.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/ansi-1.5.0/test/case_bbcode.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/ansi-1.5.0/test/case_bbcode.rb