diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2020-03-12 13:55:20 +0100 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2020-03-15 20:53:14 +0900 |
commit | 47b08728cf3d0441a3da4dc1dcdd578817b0e036 (patch) | |
tree | bf19941c7899a3f47e71d01b2db5e92390d2d459 /test | |
parent | 3efbd527a86203406664a01126784a10eb136405 (diff) | |
download | ruby-47b08728cf3d0441a3da4dc1dcdd578817b0e036.tar.gz |
[ruby/stringio] StringIO#initialize default to the source string encoding
[Bug #16497]
https://github.com/ruby/stringio/commit/4958a5ccab
(cherry picked from commit e257c08f2ec27e2d66cdfa7e2415deb492522e22)
Diffstat (limited to 'test')
-rw-r--r-- | test/stringio/test_stringio.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 663a33be27..a99ccf4302 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -797,6 +797,18 @@ class TestStringIO < Test::Unit::TestCase end end + def test_binary_encoding_read_and_default_internal + verbose, $VERBOSE = $VERBOSE, nil + default_internal = Encoding.default_internal + Encoding.default_internal = Encoding::UTF_8 + $VERBOSE = verbose + assert_equal Encoding::BINARY, StringIO.new("Hello".b).read.encoding + ensure + $VERBOSE = nil + Encoding.default_internal = default_internal + $VERBOSE = verbose + end + def assert_string(content, encoding, str, mesg = nil) assert_equal([content, encoding], [str, str.encoding], mesg) end |