diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-06 13:24:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-06 13:24:09 +0000 |
commit | 6548425ee0339de8bab5e0124d0c3f57d517b953 (patch) | |
tree | 614ec9acbe29363dfadee826a34a05883333209e | |
parent | ecbf8351808c2425ec081c9055c9ddd790933e8b (diff) | |
download | ruby-6548425ee0339de8bab5e0124d0c3f57d517b953.tar.gz |
test_dir_m17n.rb: fix tests
* test/ruby/test_dir_m17n.rb (with_enc_path): test with UTF-8
default external encoding for non-locale environments.
* test/ruby/test_dir_m17n.rb (test_glob_warning_opendir): valid
only if file permissions work.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_dir_m17n.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb index 325b1571c9..a72598b360 100644 --- a/test/ruby/test_dir_m17n.rb +++ b/test/ruby/test_dir_m17n.rb @@ -307,11 +307,13 @@ class TestDir_M17N < Test::Unit::TestCase with_tmpdir do |d| names = %W"\u{391 392 393 394 395} \u{3042 3044 3046 3048 304a}" names.each do |dir| - Dir.mkdir(dir) rescue next - begin - yield(dir) - ensure - File.chmod(0700, dir) + EnvUtil.with_default_external(Encoding::UTF_8) do + Dir.mkdir(dir) rescue next + begin + yield(dir) + ensure + File.chmod(0700, dir) + end end end end @@ -321,6 +323,7 @@ class TestDir_M17N < Test::Unit::TestCase with_enc_path do |dir| open("#{dir}/x", "w") {} File.chmod(0300, dir) + next if File.readable?(dir) assert_warning(/#{dir}/) do Dir.glob("#{dir}/*") end @@ -331,6 +334,7 @@ class TestDir_M17N < Test::Unit::TestCase with_enc_path do |dir| open("#{dir}/x", "w") {} File.chmod(0000, dir) + next if File.readable?(dir) assert_warning(/#{dir}/) do Dir.glob("#{dir}/x") end @@ -341,6 +345,7 @@ class TestDir_M17N < Test::Unit::TestCase with_enc_path do |dir| Dir.mkdir("#{dir}/x") File.chmod(0000, dir) + next if File.readable?(dir) assert_warning(/#{dir}/) do Dir.glob("#{dir}/x/") end |