From cc2a16d94d744d14d4a5eb06eca22137f8a9b79e Mon Sep 17 00:00:00 2001 From: drbrain Date: Wed, 2 Feb 2011 00:32:30 +0000 Subject: Import RDoc 3.5.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rdoc/test_rdoc_text.rb | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'test/rdoc/test_rdoc_text.rb') diff --git a/test/rdoc/test_rdoc_text.rb b/test/rdoc/test_rdoc_text.rb index 600de30b0b..ebc92dc1a5 100644 --- a/test/rdoc/test_rdoc_text.rb +++ b/test/rdoc/test_rdoc_text.rb @@ -134,6 +134,31 @@ The comments associated with assert_equal expected, strip_hashes(text) end + def test_strip_hashes_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::CP852 + + expected = <<-EXPECTED + + we don't worry too much. + + The comments associated with + EXPECTED + + stripped = strip_hashes text + + assert_equal expected, stripped + assert_equal Encoding::CP852, stripped.encoding + end + def test_strip_newlines assert_equal ' ', strip_newlines("\n \n") @@ -144,6 +169,21 @@ The comments associated with assert_equal 'hi', strip_newlines("\n\nhi\n\n") end + def test_strip_newlines_encoding + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + assert_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check' + + text = " \n" + text.force_encoding Encoding::US_ASCII + + stripped = strip_newlines text + + assert_equal ' ', stripped + + assert_equal Encoding::US_ASCII, stripped.encoding + end + def test_strip_stars text = <<-TEXT /* @@ -163,6 +203,30 @@ The comments associated with assert_equal expected, strip_stars(text) end + def test_strip_stars_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::CP852 + + expected = <<-EXPECTED + + * we don't worry too much. + + The comments associated with + EXPECTED + + assert_equal expected, strip_stars(text) + assert_equal Encoding::CP852, text.encoding + end + def test_to_html_apostrophe assert_equal '‘a', to_html("'a") assert_equal 'a’', to_html("a'") -- cgit v1.2.3