diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2020-03-12 13:55:20 +0100 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-03-15 18:43:01 +0900 |
commit | e257c08f2ec27e2d66cdfa7e2415deb492522e22 (patch) | |
tree | 81fd971c2851d40248d0f1229661eda210b2c36e /test | |
parent | d79890cbfaa32444e3bab60835d7f09abf3d9469 (diff) |
[ruby/stringio] StringIO#initialize default to the source string encoding
[Bug #16497]
https://github.com/ruby/stringio/commit/4958a5ccab
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 |