aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_encoding.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-07 07:07:12 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-07 07:07:12 +0000
commit60f2c9cf5bea6dd99fac50c460eab4809cc30b01 (patch)
treeab40b4f7be3ff6d9fc8aede6b90e1aa9dded0aff /test/rdoc/test_rdoc_encoding.rb
parentca9f7009db8aea70af3dd58cb6c7de0010844d22 (diff)
downloadruby-60f2c9cf5bea6dd99fac50c460eab4809cc30b01.tar.gz
Upgrade to RDoc 3.5.3. Fixes [Bug #4376]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_encoding.rb')
-rw-r--r--test/rdoc/test_rdoc_encoding.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb
index de6c10f678..f6c113affc 100644
--- a/test/rdoc/test_rdoc_encoding.rb
+++ b/test/rdoc/test_rdoc_encoding.rb
@@ -49,6 +49,26 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
assert_equal "hi \u00e9verybody", contents.sub("\r", '')
end
+ def test_class_read_file_encoding_fail
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ @tempfile.write "# coding: utf-8\n\317\200" # pi
+ @tempfile.flush
+
+ # FIXME 1.9 fix on windoze
+ expected.gsub!("\n", "\r\n") if RUBY_VERSION =~ /^1.9/ && RUBY_PLATFORM =~ /mswin|mingw/
+
+ contents = :junk
+
+ _, err = capture_io do
+ contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII
+ end
+
+ assert_nil contents
+
+ assert_match %r%^unable to convert%, err
+ end
+
def test_class_read_file_encoding_fancy
skip "Encoding not implemented" unless Object.const_defined? :Encoding
@@ -66,6 +86,21 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
assert_equal Encoding::UTF_8, contents.encoding
end
+ def test_class_read_file_encoding_force_transcode
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ @tempfile.write "# coding: utf-8\n\317\200" # pi
+ @tempfile.flush
+
+ # FIXME 1.9 fix on windoze
+ expected.gsub!("\n", "\r\n") if RUBY_VERSION =~ /^1.9/ && RUBY_PLATFORM =~ /mswin|mingw/
+
+ contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII, true
+
+ assert_equal '?', contents
+ assert_equal Encoding::US_ASCII, contents.encoding
+ end
+
def test_class_read_file_encoding_guess
skip "Encoding not implemented" unless Object.const_defined? :Encoding