1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_dir_m17n.rb: read in filesystem encoding

* test/ruby/test_dir_m17n.rb (test_entries_compose): read in
  filesystem encoding instead of default external encoding on
  Windows too.  these two encodings may differ on some
  environments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-05-17 00:28:01 +00:00
parent 8dbf0f2ac7
commit a0b6e36609

View file

@ -404,12 +404,12 @@ class TestDir_M17N < Test::Unit::TestCase
with_tmpdir {|d|
orig = %W"d\u{e9}tente x\u{304c 304e 3050 3052 3054}"
orig.each {|n| open(n, "w") {}}
enc = Encoding.find("filesystem")
enc = Encoding::ASCII_8BIT if enc == Encoding::US_ASCII
if /mswin|mingw/ =~ RUBY_PLATFORM
opts = {:encoding => Encoding.default_external}
opts = {:encoding => enc}
orig.map! {|o| o.encode("filesystem") rescue o.tr("^a-z", "?")}
else
enc = Encoding.find("filesystem")
enc = Encoding::ASCII_8BIT if enc == Encoding::US_ASCII
orig.each {|o| o.force_encoding(enc) }
end
ents = Dir.entries(".", opts).reject {|n| /\A\./ =~ n}