mirror of
https://github.com/ruby/ruby.git
synced 2025-09-22 12:04:01 +02:00
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
This commit is contained in:
parent
18db8cea6a
commit
ef5b8fe12f
2 changed files with 84 additions and 12 deletions
|
@ -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]'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue