mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
02f4dcca2c
* test/rdoc/test_rdoc_ri_overstrike_formatter.rb: Added. * test/rdoc/test_rdoc_ri_formatter.rb: Added tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
61 lines
1.4 KiB
Ruby
61 lines
1.4 KiB
Ruby
require 'stringio'
|
|
require 'test/unit'
|
|
require 'rdoc/ri/formatter'
|
|
require 'rdoc/markup/fragments'
|
|
require 'rdoc/markup/to_flow'
|
|
|
|
class TestRDocRIOverstrikeFormatter < Test::Unit::TestCase
|
|
|
|
def setup
|
|
@output = StringIO.new
|
|
@width = 78
|
|
@indent = ' '
|
|
|
|
@f = RDoc::RI::OverstrikeFormatter.new @output, @width, @indent
|
|
@markup = RDoc::Markup.new
|
|
@flow = RDoc::Markup::ToFlow.new
|
|
|
|
@af = RDoc::RI::AttributeFormatter
|
|
end
|
|
|
|
def test_write_attribute_text_bold
|
|
line = [RDoc::RI::AttributeFormatter::AttrChar.new('b', @af::BOLD)]
|
|
|
|
@f.write_attribute_text ' ', line
|
|
|
|
assert_equal " b\bb\n", @output.string
|
|
end
|
|
|
|
def test_write_attribute_text_bold_italic
|
|
attr = @af::BOLD | @af::ITALIC
|
|
line = [RDoc::RI::AttributeFormatter::AttrChar.new('d', attr)]
|
|
|
|
@f.write_attribute_text ' ', line
|
|
|
|
assert_equal " _\bd\bd\n", @output.string
|
|
end
|
|
|
|
def test_write_attribute_text_code
|
|
line = [RDoc::RI::AttributeFormatter::AttrChar.new('c', @af::CODE)]
|
|
|
|
@f.write_attribute_text ' ', line
|
|
|
|
assert_equal " _\bc\n", @output.string
|
|
end
|
|
|
|
def test_write_attribute_text_italic
|
|
line = [RDoc::RI::AttributeFormatter::AttrChar.new('a', @af::ITALIC)]
|
|
|
|
@f.write_attribute_text ' ', line
|
|
|
|
assert_equal " _\ba\n", @output.string
|
|
end
|
|
|
|
def test_bold_print
|
|
@f.bold_print 'a b c'
|
|
|
|
assert_equal "a\ba \b b\bb \b c\bc", @output.string
|
|
end
|
|
|
|
end
|
|
|