OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / test / rdoc / test_rdoc_ri_attribute_formatter.rb
1 require 'stringio'
2 require 'rubygems'
3 require 'minitest/unit'
4 require 'rdoc/ri/formatter'
5
6 class TestRDocRIAttributeFormatter < MiniTest::Unit::TestCase
7
8   def setup
9     @output = StringIO.new
10     @width = 78
11     @indent = '  '
12
13     @f = RDoc::RI::AttributeFormatter.new @output, @width, @indent
14   end
15
16   def test_wrap_empty
17     @f.wrap ''
18     assert_equal '', @output.string
19   end
20
21   def test_wrap_long
22     @f.wrap 'a ' * (@width / 2)
23     assert_equal "  a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \n  a \n",
24                  @output.string
25   end
26
27   def test_wrap_markup
28     @f.wrap 'a <tt>b</tt> c'
29     assert_equal "  a b c\n", @output.string
30   end
31
32   def test_wrap_nil
33     @f.wrap nil
34     assert_equal '', @output.string
35   end
36
37   def test_wrap_short
38     @f.wrap 'a b c'
39     assert_equal "  a b c\n", @output.string
40   end
41
42 end
43
44 MiniTest::Unit.autorun