From f4726dcdaa421fa9bb2077b5de195acc5e3d4271 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 25 Feb 2015 06:59:39 +0000 Subject: 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 --- test/ruby/test_dir_m17n.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb index 04186e54a7..f8fc1ef5e4 100644 --- a/test/ruby/test_dir_m17n.rb +++ b/test/ruby/test_dir_m17n.rb @@ -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]' -- cgit v1.2.3