mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 11:33:58 +02:00
Fix the encoding of loaded feature names [Bug #18191]
The feature names loaded from the default load paths should also be in the file system encoding.
This commit is contained in:
parent
8e9d696ed0
commit
60d0421ca8
Notes:
git
2021-10-01 20:29:14 +09:00
2 changed files with 33 additions and 1 deletions
|
@ -531,6 +531,28 @@ class TestRequire < Test::Unit::TestCase
|
|||
$".replace(features)
|
||||
end
|
||||
|
||||
def test_default_loaded_features_encoding
|
||||
Dir.mktmpdir {|tmp|
|
||||
Dir.mkdir("#{tmp}/1")
|
||||
Dir.mkdir("#{tmp}/2")
|
||||
File.write("#{tmp}/1/bug18191-1.rb", "")
|
||||
File.write("#{tmp}/2/bug18191-2.rb", "")
|
||||
assert_separately(%W[-Eutf-8 -I#{tmp}/1 -], "#{<<~"begin;"}\n#{<<~'end;'}")
|
||||
tmp = #{tmp.dump}"/2"
|
||||
begin;
|
||||
$:.unshift(tmp)
|
||||
require "bug18191-1"
|
||||
require "bug18191-2"
|
||||
encs = [Encoding::US_ASCII, Encoding.find("filesystem")]
|
||||
message = -> {
|
||||
require "pp"
|
||||
{filesystem: encs[1], **$".group_by(&:encoding)}.pretty_inspect
|
||||
}
|
||||
assert($".all? {|n| encs.include?(n.encoding)}, message)
|
||||
end;
|
||||
}
|
||||
end
|
||||
|
||||
def test_require_changed_current_dir
|
||||
bug7158 = '[ruby-core:47970]'
|
||||
Dir.mktmpdir {|tmp|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue