aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_encoding.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-28 22:08:56 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-28 22:08:56 +0000
commite2efe8e81dc7e9fce40b024df6a20bbf4b830350 (patch)
tree942e66e071e759c7db670a42daeac26c7437f25b /test/rdoc/test_rdoc_encoding.rb
parent90d5bcf9104fe58887cf705b718a9c7b537b51a5 (diff)
downloadruby-e2efe8e81dc7e9fce40b024df6a20bbf4b830350.tar.gz
Import RDoc 3.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_encoding.rb')
-rw-r--r--test/rdoc/test_rdoc_encoding.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb
index b940d93606..de6c10f678 100644
--- a/test/rdoc/test_rdoc_encoding.rb
+++ b/test/rdoc/test_rdoc_encoding.rb
@@ -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