3 require 'rdoc/ri/formatter'
4 require 'rdoc/markup/fragments'
5 require 'rdoc/markup/to_flow'
7 class TestRDocRIOverstrikeFormatter < Test::Unit::TestCase
10 @output = StringIO.new
14 @f = RDoc::RI::OverstrikeFormatter.new @output, @width, @indent
15 @markup = RDoc::Markup.new
16 @flow = RDoc::Markup::ToFlow.new
18 @af = RDoc::RI::AttributeFormatter
21 def test_display_verbatim_flow_item_bold
22 verbatim = RDoc::Markup::Flow::VERB.new "*a* b c"
24 @f.display_verbatim_flow_item verbatim
26 assert_equal " *a* b c\n\n", @output.string
29 def test_write_attribute_text_bold
30 line = [RDoc::RI::AttributeFormatter::AttrChar.new('b', @af::BOLD)]
32 @f.write_attribute_text ' ', line
34 assert_equal " b\bb\n", @output.string
37 def test_write_attribute_text_bold_italic
38 attr = @af::BOLD | @af::ITALIC
39 line = [RDoc::RI::AttributeFormatter::AttrChar.new('d', attr)]
41 @f.write_attribute_text ' ', line
43 assert_equal " _\bd\bd\n", @output.string
46 def test_write_attribute_text_code
47 line = [RDoc::RI::AttributeFormatter::AttrChar.new('c', @af::CODE)]
49 @f.write_attribute_text ' ', line
51 assert_equal " _\bc\n", @output.string
54 def test_write_attribute_text_italic
55 line = [RDoc::RI::AttributeFormatter::AttrChar.new('a', @af::ITALIC)]
57 @f.write_attribute_text ' ', line
59 assert_equal " _\ba\n", @output.string
65 assert_equal "a\ba \b b\bb \b c\bc", @output.string