aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_encoding.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-05 10:35:30 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-05 10:35:30 +0000
commit8186c3994e0cf1f91070176af66846d8f1556ec4 (patch)
tree362b9fc870edb3820ef488a6618baf5669d3aa48 /test/rdoc/test_rdoc_encoding.rb
parent0de432c787ece6a2ad88a8694526da29ad663b62 (diff)
downloadruby-8186c3994e0cf1f91070176af66846d8f1556ec4.tar.gz
* lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513)
https://github.com/rdoc/rdoc/blob/master/History.rdoc#423--2016-- https://github.com/rdoc/rdoc/blob/master/History.rdoc#422--2016-02-09 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_encoding.rb')
-rw-r--r--test/rdoc/test_rdoc_encoding.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb
index 313ede2bde..74d2a2668a 100644
--- a/test/rdoc/test_rdoc_encoding.rb
+++ b/test/rdoc/test_rdoc_encoding.rb
@@ -217,6 +217,45 @@ class TestRDocEncoding < RDoc::TestCase
end
end
+ def test_skip_frozen_string_literal
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ expected = "# frozen_string_literal: false\nhi everybody"
+
+ @tempfile.write expected
+ @tempfile.flush
+
+ contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
+ assert_equal "hi everybody", contents
+ assert_equal Encoding::UTF_8, contents.encoding
+ end
+
+ def test_skip_frozen_string_literal_after_coding
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ expected = "# coding: utf-8\n# frozen-string-literal: false\nhi everybody"
+
+ @tempfile.write expected
+ @tempfile.flush
+
+ contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
+ assert_equal "hi everybody", contents
+ assert_equal Encoding::UTF_8, contents.encoding
+ end
+
+ def test_skip_frozen_string_literal_before_coding
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ expected = "# frozen_string_literal: false\n# coding: utf-8\nhi everybody"
+
+ @tempfile.write expected
+ @tempfile.flush
+
+ contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
+ assert_equal "hi everybody", contents
+ assert_equal Encoding::UTF_8, contents.encoding
+ end
+
def test_sanity
skip "Encoding not implemented" unless Object.const_defined? :Encoding