2008-01-19 03:06:19 +03:00
|
|
|
require 'stringio'
|
2008-10-25 03:05:28 +04:00
|
|
|
require 'rubygems'
|
|
|
|
require 'minitest/unit'
|
2008-01-19 03:06:19 +03:00
|
|
|
require 'rdoc/ri/formatter'
|
|
|
|
|
2008-10-25 03:05:28 +04:00
|
|
|
class TestRDocRIAttributeFormatter < MiniTest::Unit::TestCase
|
2008-01-19 03:06:19 +03:00
|
|
|
|
|
|
|
def setup
|
|
|
|
@output = StringIO.new
|
|
|
|
@width = 78
|
|
|
|
@indent = ' '
|
|
|
|
|
|
|
|
@f = RDoc::RI::AttributeFormatter.new @output, @width, @indent
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_wrap_empty
|
|
|
|
@f.wrap ''
|
|
|
|
assert_equal '', @output.string
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_wrap_long
|
|
|
|
@f.wrap 'a ' * (@width / 2)
|
|
|
|
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",
|
|
|
|
@output.string
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_wrap_markup
|
|
|
|
@f.wrap 'a <tt>b</tt> c'
|
|
|
|
assert_equal " a b c\n", @output.string
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_wrap_nil
|
|
|
|
@f.wrap nil
|
|
|
|
assert_equal '', @output.string
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_wrap_short
|
|
|
|
@f.wrap 'a b c'
|
|
|
|
assert_equal " a b c\n", @output.string
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2008-10-25 03:05:28 +04:00
|
|
|
MiniTest::Unit.autorun
|