diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-29 14:48:39 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-29 14:48:39 +0000 |
commit | dd4399e231c3b73008a69adb6eca8803de8a7d78 (patch) | |
tree | 0540233874d1de5f21e618277a740655734ec41d /test | |
parent | e34df45eba73ebd58523d5f970f94d1cd3e0d43a (diff) |
merge revision(s) 53877,53881: [Backport #12081]
* dir.c (push_pattern, push_glob): deal with read paths as UTF-8
to stat later, on Windows as well as OS X.
[ruby-core:73868] [Bug #12081]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_dir_m17n.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb index febfbc0511..4efc8ca34d 100644 --- a/test/ruby/test_dir_m17n.rb +++ b/test/ruby/test_dir_m17n.rb @@ -365,10 +365,24 @@ class TestDir_M17N < Test::Unit::TestCase def test_glob_encoding with_tmpdir do - %W"file_one.ext file_two.ext".each {|f| open(f, "w") {}} + list = %W"file_one.ext file_two.ext \u{6587 4ef6}1.txt \u{6587 4ef6}2.txt" + list.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)) + dir = "\u{76EE 5F551}" + Dir.mkdir(dir) + list << dir + bug12081 = '[ruby-core:73868] [Bug #12081]' + a = "*".force_encoding("us-ascii") + result = Dir[a].map {|n| + if n.encoding == Encoding::ASCII_8BIT + n.force_encoding(Encoding::UTF_8) + else + n.encode(Encoding::UTF_8) + end + } + assert_equal(list, result.sort!, bug12081) end end |