diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-06 08:37:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-06 08:37:27 +0000 |
commit | ef5b8fe12f2d1c4a24c71c7965b7e7184ad613d6 (patch) | |
tree | af0524c4b49127f5e636dd28f8bb553e83cd7b35 /test | |
parent | 18db8cea6ae5ff22353e32a4b26d421b5f5c4c51 (diff) | |
download | ruby-ef5b8fe12f2d1c4a24c71c7965b7e7184ad613d6.tar.gz |
dir.c: preserve encoding
* dir.c (sys_enc_warning_in): preserve encoding of path name in
warning messages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_dir_m17n.rb | 44 |
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]' |