1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Import RDoc 3.1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2010-12-28 22:08:56 +00:00
parent 90d5bcf910
commit e2efe8e81d
28 changed files with 494 additions and 56 deletions

View file

@ -30,7 +30,7 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
expected.gsub!("\n", "\r\n") if RUBY_VERSION =~ /^1.9/ && RUBY_PLATFORM =~ /mswin|mingw/
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
assert_equal expected, contents
assert_equal "hi everybody", contents
assert_equal Encoding::UTF_8, contents.encoding
end
@ -46,7 +46,7 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
assert_equal Encoding::UTF_8, contents.encoding
assert_equal "# coding: ISO-8859-1\nhi \u00e9verybody", contents.sub("\r", '')
assert_equal "hi \u00e9verybody", contents.sub("\r", '')
end
def test_class_read_file_encoding_fancy
@ -62,7 +62,7 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
expected.gsub!("\n", "\r\n") if RUBY_VERSION =~ /^1.9/ && RUBY_PLATFORM =~ /win32|mingw32/
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
assert_equal expected, contents
assert_equal "hi everybody", contents
assert_equal Encoding::UTF_8, contents.encoding
end
@ -115,6 +115,20 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
assert_equal Encoding::UTF_8, s.encoding
end
def test_class_set_encoding_strip
s = "# coding: UTF-8\n# more comments"
RDoc::Encoding.set_encoding s
assert_equal "# more comments", s
s = "#!/bin/ruby\n# coding: UTF-8\n# more comments"
RDoc::Encoding.set_encoding s
assert_equal "# more comments", s
end
def test_class_set_encoding_bad
skip "Encoding not implemented" unless Object.const_defined? :Encoding
@ -141,5 +155,12 @@ class TestRDocEncoding < MiniTest::Unit::TestCase
end
end
def test_sanity
skip "Encoding not implemented" unless Object.const_defined? :Encoding
assert_equal Encoding::US_ASCII, ''.encoding,
'If this file is not ASCII tests may incorrectly pass'
end
end