summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-20 09:36:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-20 09:36:08 +0000
commitab86bab950ca05d5aca8a738c58500eea7a21227 (patch)
tree5021f3b7bd9daad2fc96b2ad5a86f9d6eea66126
parent68d4d7e41f00ce71a5d737a711278fb7b3c6da12 (diff)
test_dir_m17n.rb: fix ASCII-8BIT env
* test/ruby/test_dir_m17n.rb (test_glob_encoding): get rid of conversion when LC_ALL=C and filesystem encoding is ASCII-8BIT. [ruby-core:73868] [Bug #12081] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_dir_m17n.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb
index c6be8b6..4efc8ca 100644
--- a/test/ruby/test_dir_m17n.rb
+++ b/test/ruby/test_dir_m17n.rb
@@ -375,7 +375,14 @@ class TestDir_M17N < Test::Unit::TestCase
list << dir
bug12081 = '[ruby-core:73868] [Bug #12081]'
a = "*".force_encoding("us-ascii")
- assert_equal(list, Dir[a].map {|n| n.encode(Encoding::UTF_8)}.sort, bug12081)
+ 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