diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-27 04:28:14 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-27 04:28:14 +0000 |
commit | 1c279a7d2753949c725754e1302f791b76358114 (patch) | |
tree | 36aa3bdde250e564445eba5f2e25fcb96bcb6cef /test/rdoc/test_rdoc_encoding.rb | |
parent | c72f0daa877808e4fa5018b3191ca09d4b97c03d (diff) | |
download | ruby-1c279a7d2753949c725754e1302f791b76358114.tar.gz |
* lib/rdoc*: Updated to RDoc 4.0 (pre-release)
* bin/rdoc: ditto
* test/rdoc: ditto
* NEWS: Updated with RDoc 4.0 information
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_encoding.rb')
-rw-r--r-- | test/rdoc/test_rdoc_encoding.rb | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb index b5ffd7714c..d43bc2e244 100644 --- a/test/rdoc/test_rdoc_encoding.rb +++ b/test/rdoc/test_rdoc_encoding.rb @@ -1,15 +1,12 @@ # coding: US-ASCII -require 'rubygems' -require 'minitest/autorun' -require 'rdoc' -require 'rdoc/encoding' +require 'rdoc/test_case' -require 'tempfile' - -class TestRDocEncoding < MiniTest::Unit::TestCase +class TestRDocEncoding < RDoc::TestCase def setup + super + @tempfile = Tempfile.new 'test_rdoc_encoding' end @@ -100,6 +97,22 @@ class TestRDocEncoding < MiniTest::Unit::TestCase assert_equal Encoding::UTF_8, content.encoding end + def test_class_read_file_encoding_invalid + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + @tempfile.write "# coding: ascii\nM\xE4r" + @tempfile.flush + + contents = :junk + _, err = capture_io do + contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 + end + + assert_equal "unable to convert \"\\xE4\" on US-ASCII for #{@tempfile.path}, skipping\n", err + + assert_nil contents + end + def test_class_read_file_encoding_with_signature skip "Encoding not implemented" unless defined? ::Encoding |