* test/ruby/test_dir_m17n.rb: HFS+ escapes invalid byte sequences of filenames.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
muraken 2010-03-25 02:37:22 +00:00
parent da8a31bc47
commit 31bc607cf1
2 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,8 @@
Thu Mar 25 11:34:00 2010 Kenta Murata <mrkn@mrkn.jp>
* test/ruby/test_dir_m17n.rb: HFS+ escapes invalid byte sequences of
filenames.
Thu Mar 25 05:44:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Mar 25 05:44:31 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (ruby_version): needs runnable CPP. * configure.in (ruby_version): needs runnable CPP.

View File

@ -30,13 +30,13 @@ class TestDir_M17N < Test::Unit::TestCase
filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8 filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8
File.open(filename, "w") {} File.open(filename, "w") {}
ents = Dir.entries(".") ents = Dir.entries(".")
exit ents.include?(filename) exit ents.include?(filename) || (RUBY_PLATFORM =~ /darwin/ && ents.include?("%FF"))
EOS EOS
assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d) assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)
filename = "\xff".force_encoding("UTF-8") # invalid byte sequence as UTF-8 filename = "\xff".force_encoding("UTF-8") # invalid byte sequence as UTF-8
File.open(filename, "w") {} File.open(filename, "w") {}
ents = Dir.entries(".") ents = Dir.entries(".")
exit ents.include?(filename) exit ents.include?(filename) || (RUBY_PLATFORM =~ /darwin/ && ents.include?("%FF"))
EOS EOS
} }
end end
@ -136,7 +136,8 @@ class TestDir_M17N < Test::Unit::TestCase
File.open(filename, "w") {} File.open(filename, "w") {}
ents = Dir.entries(".") ents = Dir.entries(".")
ents.each {|e| e.force_encoding("ASCII-8BIT") } ents.each {|e| e.force_encoding("ASCII-8BIT") }
exit ents.include?(filename.force_encoding("ASCII-8BIT")) exit ents.include?(filename.force_encoding("ASCII-8BIT")) ||
(RUBY_PLATFORM =~ /darwin/ && ents.include?("%A4%A2".force_encoding("ASCII-8BIT")))
EOS EOS
} }
end end
@ -147,12 +148,14 @@ class TestDir_M17N < Test::Unit::TestCase
filename = "\xA4\xA2".force_encoding("euc-jp") filename = "\xA4\xA2".force_encoding("euc-jp")
File.open(filename, "w") {} File.open(filename, "w") {}
ents = Dir.entries(".") ents = Dir.entries(".")
exit ents.include?(filename) exit ents.include?(filename) ||
(RUBY_PLATFORM =~ /darwin/ && ents.include?("%A4%A2".force_encoding("euc-jp")))
EOS EOS
assert_ruby_status(%w[-EASCII-8BIT], <<-'EOS', nil, :chdir=>d) assert_ruby_status(%w[-EASCII-8BIT], <<-'EOS', nil, :chdir=>d)
filename = "\xA4\xA2" filename = "\xA4\xA2"
ents = Dir.entries(".") ents = Dir.entries(".")
exit ents.include?(filename) exit ents.include?(filename) ||
(RUBY_PLATFORM =~ /darwin/ && ents.include?("%A4%A2".force_encoding("ASCII-8BIT")))
EOS EOS
} }
end end
@ -179,15 +182,15 @@ class TestDir_M17N < Test::Unit::TestCase
filename = "\xA4\xA2".force_encoding("euc-jp") filename = "\xA4\xA2".force_encoding("euc-jp")
File.open(filename, "w") {} File.open(filename, "w") {}
ents = Dir.entries(".") ents = Dir.entries(".")
exit ents.include?(filename) exit ents.include?(filename) ||
(RUBY_PLATFORM =~ /darwin/ && ents.include?("%A4%A2".force_encoding("euc-jp")))
EOS EOS
assert_ruby_status(%w[-EEUC-JP:UTF-8], <<-'EOS', nil, :chdir=>d) assert_ruby_status(%w[-EEUC-JP:UTF-8], <<-'EOS', nil, :chdir=>d)
filename = "\u3042" filename = "\u3042"
ents = Dir.entries(".") ents = Dir.entries(".")
exit ents.include?(filename) exit ents.include?(filename) || (RUBY_PLATFORM =~ /darwin/ && ents.include?("%A4%A2"))
EOS EOS
} }
end end
end end