summaryrefslogtreecommitdiff
path: root/test/ruby/test_dir_m17n.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_dir_m17n.rb')
-rw-r--r--test/ruby/test_dir_m17n.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb
index 0547f2e62e..325b1571c9 100644
--- a/test/ruby/test_dir_m17n.rb
+++ b/test/ruby/test_dir_m17n.rb
@@ -303,6 +303,50 @@ class TestDir_M17N < Test::Unit::TestCase
}
end
+ def with_enc_path
+ 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)
+ end
+ end
+ end
+ end
+
+ def test_glob_warning_opendir
+ with_enc_path do |dir|
+ open("#{dir}/x", "w") {}
+ File.chmod(0300, dir)
+ assert_warning(/#{dir}/) do
+ Dir.glob("#{dir}/*")
+ end
+ end
+ end
+
+ def test_glob_warning_match_all
+ with_enc_path do |dir|
+ open("#{dir}/x", "w") {}
+ File.chmod(0000, dir)
+ assert_warning(/#{dir}/) do
+ Dir.glob("#{dir}/x")
+ end
+ end
+ end
+
+ def test_glob_warning_match_dir
+ with_enc_path do |dir|
+ Dir.mkdir("#{dir}/x")
+ File.chmod(0000, dir)
+ assert_warning(/#{dir}/) do
+ Dir.glob("#{dir}/x/")
+ end
+ end
+ end
+
def test_entries_compose
bug7267 = '[ruby-core:48745] [Bug #7267]'