ruby-changes:37450
From: nobu <ko1@a...>
Date: Fri, 6 Feb 2015 22:24:25 +0900 (JST)
Subject: [ruby-changes:37450] nobu:r49531 (trunk): test_dir_m17n.rb: fix tests
nobu 2015-02-06 22:24:09 +0900 (Fri, 06 Feb 2015) New Revision: 49531 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49531 Log: 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. Modified files: trunk/test/ruby/test_dir_m17n.rb Index: test/ruby/test_dir_m17n.rb =================================================================== --- test/ruby/test_dir_m17n.rb (revision 49530) +++ test/ruby/test_dir_m17n.rb (revision 49531) @@ -307,11 +307,13 @@ class TestDir_M17N < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir_m17n.rb#L307 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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir_m17n.rb#L323 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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir_m17n.rb#L334 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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir_m17n.rb#L345 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/