diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-20 08:39:10 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-20 08:39:10 +0000 |
commit | e896f104872e85a8c35e15a6e938423b6d6aca03 (patch) | |
tree | cd8d02b7641c2106c192b0d25b6a7f21562ba60e /test | |
parent | a712ced7cbef41910bef32af362af22348826646 (diff) |
merge revision(s) 49528:
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/branches/ruby_2_2@49665 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]' |