diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-04 08:20:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-04 08:20:05 +0000 |
commit | 8d9b300a72ec3de3b88aae973661be347df7a028 (patch) | |
tree | 37a7f79815daead701b5fe9bcaf8e1e0abea9de5 /test/ruby/test_dir.rb | |
parent | 171a14b36cf61a1aae127d3b73b1aedd0657ab01 (diff) | |
download | ruby-8d9b300a72ec3de3b88aae973661be347df7a028.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@44807 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"] |