summaryrefslogtreecommitdiff
path: root/test/psych/test_encoding.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-27 03:11:18 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-27 03:11:18 +0000
commitb613a2c5ae03c425bc94771e4eced1b80e4e80d0 (patch)
treea2bd8c92dbafcc5897e4105682517df190e35f3f /test/psych/test_encoding.rb
parent33201294eb59f10ccb98752207c2cc9d1c8757cc (diff)
Merge psych-3.0.0.beta4 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/test_encoding.rb')
-rw-r--r--test/psych/test_encoding.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/psych/test_encoding.rb b/test/psych/test_encoding.rb
index a4f9f036fd..ef6653142f 100644
--- a/test/psych/test_encoding.rb
+++ b/test/psych/test_encoding.rb
@@ -106,6 +106,18 @@ module Psych
}
end
+ def test_io_utf8_read_as_binary
+ Tempfile.create(['utf8', 'yml']) {|t|
+ t.binmode
+ t.write '--- こんにちは!'.encode('UTF-8')
+ t.close
+
+ File.open(t.path, 'rb', :encoding => 'ascii-8bit') do |f|
+ assert_equal "こんにちは!", Psych.load(f)
+ end
+ }
+ end
+
def test_emit_alias
@emitter.start_stream Psych::Parser::UTF8
@emitter.start_document [], [], true