dir.c: same encoding to the pattern

* dir.c (push_pattern, push_glob): make globbed file names same
  encoding to the given pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-02-25 06:59:39 +00:00
parent ca3f71b8b5
commit f4726dcdaa
3 changed files with 29 additions and 7 deletions

View file

@ -362,6 +362,15 @@ class TestDir_M17N < Test::Unit::TestCase
end
end
def test_glob_encoding
with_tmpdir do
%W"file_one.ext file_two.ext".each {|f| open(f, "w") {}}
a = "file_one*".force_encoding Encoding::IBM437
b = "file_two*".force_encoding Encoding::EUC_JP
assert_equal([a, b].map(&:encoding), Dir[a, b].map(&:encoding))
end
end
def test_entries_compose
bug7267 = '[ruby-core:48745] [Bug #7267]'