diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-03 01:49:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-03 01:49:50 +0000 |
commit | 0f9da4228d3a73de6faa5b42b86b0dbf1da7f5f2 (patch) | |
tree | 51ba90a31c8d71a64d65d5be6d1c94f24de42786 /test/ruby/test_dir.rb | |
parent | 47345b710cdc56fa6d0d53bf4e3a01f2f85fcfb8 (diff) | |
download | ruby-0f9da4228d3a73de6faa5b42b86b0dbf1da7f5f2.tar.gz |
dir.c: glob cases on case-insensitive system
* dir.c (glob_helper): return the filename with actual cases on
the filesystem if it is case-insensitive. [ruby-core:42469]
[Feature #5994]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_dir.rb')
-rw-r--r-- | test/ruby/test_dir.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index 6054b8f7fe..b0d848c83f 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -228,6 +228,27 @@ class TestDir < Test::Unit::TestCase assert_empty(Dir.glob(File.join(@root, "<")), bug8597) end + def test_glob_cases + feature5994 = "[ruby-core:42469] [Feature #5994]" + feature5994 << "\nDir.glob should return the filename with actual cases on the filesystem" + Dir.chdir(File.join(@root, "a")) do + open("FileWithCases", "w") {} + return unless File.exist?("filewithcases") + assert_equal(%w"FileWithCases", Dir.glob("filewithcases"), feature5994) + end + Dir.chdir(File.join(@root, "c")) do + open("FileWithCases", "w") {} + mode = File.stat(".").mode + begin + File.chmod(mode & ~0444, ".") + return if mode == File.stat(".").mode + assert_equal(%w"filewithcases", Dir.glob("filewithcases"), feature5994) + ensure + File.chmod(mode, ".") + end + end + end + def test_home env_home = ENV["HOME"] env_logdir = ENV["LOGDIR"] |