diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-22 12:03:44 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-22 12:11:45 +0900 |
commit | d574b84182f4e6a17c63113abf8fe51c3b001bcc (patch) | |
tree | 8c04142345956aa0e1f3ddd1c0ec1b758dec55a8 /spec/ruby/core | |
parent | 18031f4102d7c8efc3a40b3fa65b36f94fc8a418 (diff) | |
download | ruby-d574b84182f4e6a17c63113abf8fe51c3b001bcc.tar.gz |
Fix failures on non-UTF-8 environment [Bug #18077]
Call `IOSpecs.io_fixture` with the default encoding explicitly.
`IOSpecs.closed_io` calls the method without optional `mode` which
is set to UTF-8 by default, while the default external encoding
depends on the locale environment variables.
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/io/external_encoding_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/io/internal_encoding_spec.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/spec/ruby/core/io/external_encoding_spec.rb b/spec/ruby/core/io/external_encoding_spec.rb index 25af11f686..2fcf1c7218 100644 --- a/spec/ruby/core/io/external_encoding_spec.rb +++ b/spec/ruby/core/io/external_encoding_spec.rb @@ -96,7 +96,9 @@ describe "IO#external_encoding" do ruby_version_is '3.1' do it "can be retrieved from a closed stream" do - IOSpecs.closed_io.external_encoding.should equal(Encoding.default_external) + io = IOSpecs.io_fixture("lines.txt", "r") + io.close + io.external_encoding.should equal(Encoding.default_external) end end diff --git a/spec/ruby/core/io/internal_encoding_spec.rb b/spec/ruby/core/io/internal_encoding_spec.rb index c76c9c8508..60afaf2ebd 100644 --- a/spec/ruby/core/io/internal_encoding_spec.rb +++ b/spec/ruby/core/io/internal_encoding_spec.rb @@ -115,7 +115,9 @@ describe "IO#internal_encoding" do ruby_version_is '3.1' do it "can be retrieved from a closed stream" do - IOSpecs.closed_io.internal_encoding.should equal(Encoding.default_internal) + io = IOSpecs.io_fixture("lines.txt", "r") + io.close + io.internal_encoding.should equal(Encoding.default_internal) end end |