diff options
Diffstat (limited to 'test/rdoc/test_rdoc_text.rb')
-rw-r--r-- | test/rdoc/test_rdoc_text.rb | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/test/rdoc/test_rdoc_text.rb b/test/rdoc/test_rdoc_text.rb index ebc92dc1a5..96635aaa8e 100644 --- a/test/rdoc/test_rdoc_text.rb +++ b/test/rdoc/test_rdoc_text.rb @@ -55,6 +55,18 @@ class TestRDocText < MiniTest::Unit::TestCase expand_tabs(".\t\t."), 'dot tab tab dot') end + def test_expand_tabs_encoding + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + inn = "hello\ns\tdave" + inn.force_encoding Encoding::BINARY + + out = expand_tabs inn + + assert_equal "hello\ns dave", out + assert_equal Encoding::BINARY, out.encoding + end + def test_flush_left text = <<-TEXT @@ -73,6 +85,31 @@ The comments associated with assert_equal expected, flush_left(text) end + def test_flush_left_encoding + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + text = <<-TEXT + + we don't worry too much. + + The comments associated with + TEXT + + text.force_encoding Encoding::US_ASCII + + expected = <<-EXPECTED + +we don't worry too much. + +The comments associated with + EXPECTED + + result = flush_left text + + assert_equal expected, result + assert_equal Encoding::US_ASCII, result.encoding + end + def test_markup def formatter() RDoc::Markup::ToHtml.new end @@ -223,8 +260,36 @@ The comments associated with The comments associated with EXPECTED - assert_equal expected, strip_stars(text) - assert_equal Encoding::CP852, text.encoding + result = strip_stars text + + assert_equal expected, result + assert_equal Encoding::CP852, result.encoding + end + + def test_strip_stars_encoding2 + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + text = <<-TEXT +/* + * * we don't worry too much. + * + * The comments associated with + */ + TEXT + + text.force_encoding Encoding::BINARY + + expected = <<-EXPECTED + + * we don't worry too much. + + The comments associated with + EXPECTED + + result = strip_stars text + + assert_equal expected, result + assert_equal Encoding::BINARY, result.encoding end def test_to_html_apostrophe |