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

Add the case of Unix: filesystem encoding maybe US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-07-24 08:47:51 +00:00
parent 8122db83ce
commit 756b6e661b

View file

@ -196,7 +196,9 @@ class TestDir_M17N < Test::Unit::TestCase
EOS
assert_ruby_status(%w[-EASCII-8BIT], <<-'EOS', nil, :chdir=>d)
filename = "\xA4\xA2".force_encoding('ASCII-8BIT')
win_expected_filename = filename.force_encoding("euc-jp").encode(Encoding.find("filesystem")) rescue "?"
win_expected_filename =
[Encoding::US_ASCII, Encoding::ASCII_8BIT].include?(Encoding.find("filesystem")) \
? filename : filename.encode(Encoding.find("filesystem"), "euc-jp") rescue "?"
opts = {:encoding => Encoding.default_external} if /mswin|mingw/ =~ RUBY_PLATFORM
ents = Dir.entries(".", opts)
result = ents.include?(filename) ||