mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge rdoc-6.0.0.beta4 from upstream.
It version applied `frozen_string_literal: true` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2d9f20e1cf
commit
5551871086
195 changed files with 1631 additions and 1258 deletions
|
@ -1,5 +1,5 @@
|
|||
# coding: US-ASCII
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rdoc/test_case'
|
||||
|
||||
|
@ -37,7 +37,7 @@ class TestRDocEncoding < RDoc::TestCase
|
|||
|
||||
def test_class_read_file_encoding_convert
|
||||
content = ""
|
||||
content.encode! 'ISO-8859-1'
|
||||
content = RDoc::Encoding.change_encoding content, 'ISO-8859-1'
|
||||
content << "# coding: ISO-8859-1\nhi \xE9verybody"
|
||||
|
||||
@tempfile.write content
|
||||
|
@ -65,7 +65,7 @@ class TestRDocEncoding < RDoc::TestCase
|
|||
|
||||
def test_class_read_file_encoding_fancy
|
||||
expected = "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody"
|
||||
expected.encode! Encoding::UTF_8
|
||||
exptected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8
|
||||
|
||||
@tempfile.write expected
|
||||
@tempfile.flush
|
||||
|
@ -125,7 +125,7 @@ class TestRDocEncoding < RDoc::TestCase
|
|||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
||||
|
||||
expected = ":\xe3\x82\xb3\xe3\x83\x9e\xe3\x83\xb3\xe3\x83\x89:"
|
||||
expected.force_encoding Encoding::UTF_8
|
||||
expected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8
|
||||
|
||||
assert_equal expected, contents
|
||||
assert_equal Encoding::UTF_8, contents.encoding
|
||||
|
@ -133,26 +133,24 @@ class TestRDocEncoding < RDoc::TestCase
|
|||
|
||||
def test_class_set_encoding
|
||||
s = "# coding: UTF-8\n"
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
# sanity check for 1.8
|
||||
|
||||
assert_equal Encoding::UTF_8, s.encoding
|
||||
|
||||
s = "#!/bin/ruby\n# coding: UTF-8\n"
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
assert_equal Encoding::UTF_8, s.encoding
|
||||
|
||||
s = "<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
expected = s.encoding
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
assert_equal Encoding::UTF_8, s.encoding
|
||||
|
||||
s = "<?xml version='1.0' encoding=\"UTF-8\"?>\n"
|
||||
expected = s.encoding
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
assert_equal Encoding::UTF_8, s.encoding
|
||||
end
|
||||
|
@ -160,13 +158,13 @@ class TestRDocEncoding < RDoc::TestCase
|
|||
def test_class_set_encoding_strip
|
||||
s = "# coding: UTF-8\n# more comments"
|
||||
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = 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
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
assert_equal "#!/bin/ruby\n# more comments", s
|
||||
end
|
||||
|
@ -174,29 +172,29 @@ class TestRDocEncoding < RDoc::TestCase
|
|||
def test_class_set_encoding_bad
|
||||
s = ""
|
||||
expected = s.encoding
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
assert_equal expected, s.encoding
|
||||
|
||||
s = "# vim:set fileencoding=utf-8:\n"
|
||||
expected = s.encoding
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
assert_equal expected, s.encoding
|
||||
|
||||
s = "# vim:set fileencoding=utf-8:\n"
|
||||
expected = s.encoding
|
||||
RDoc::Encoding.set_encoding s
|
||||
s = RDoc::Encoding.set_encoding s
|
||||
|
||||
assert_equal expected, s.encoding
|
||||
|
||||
assert_raises ArgumentError do
|
||||
RDoc::Encoding.set_encoding "# -*- encoding: undecided -*-\n"
|
||||
s = RDoc::Encoding.set_encoding "# -*- encoding: undecided -*-\n"
|
||||
end
|
||||
end
|
||||
|
||||
def test_skip_frozen_string_literal
|
||||
expected = "# frozen_string_literal: false\nhi everybody"
|
||||
expected = "# frozen_string_literal: true\nhi everybody"
|
||||
|
||||
@tempfile.write expected
|
||||
@tempfile.flush
|
||||
|
@ -218,7 +216,7 @@ class TestRDocEncoding < RDoc::TestCase
|
|||
end
|
||||
|
||||
def test_skip_frozen_string_literal_before_coding
|
||||
expected = "# frozen_string_literal: false\n# coding: utf-8\nhi everybody"
|
||||
expected = "# frozen_string_literal: true\n# coding: utf-8\nhi everybody"
|
||||
|
||||
@tempfile.write expected
|
||||
@tempfile.flush
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue