From 0f9da4228d3a73de6faa5b42b86b0dbf1da7f5f2 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 3 Feb 2014 01:49:50 +0000 Subject: 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 --- test/ruby/test_dir.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/ruby') 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"] -- cgit v1.2.3