diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-06 05:06:20 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-06 05:06:20 +0000 |
commit | 10d2b5ec466d321ab7e4662088c9e2d285266c04 (patch) | |
tree | e5ccea3c1db97484de69a4631053d1709c523f4b /test | |
parent | 34a542cb70a59a40f5819dbb9d73e744d1bb5b2f (diff) |
merge revision(s) 36905: [Backport #6977]
* dir.c (glob_make_pattern): names under recursive need to be single
basenames to match for each name. [ruby-core:47418] [Bug #6977]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@39090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_dir.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index 236fd991db..b688cc4dd0 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -171,6 +171,20 @@ class TestDir < Test::Unit::TestCase assert_raise(Encoding::CompatibilityError) {Dir.glob(m.new)} end + def test_glob_recursive + bug6977 = '[ruby-core:47418]' + Dir.chdir(@root) do + FileUtils.mkdir_p("a/b/c/d/e/f") + assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/e/f"), bug6977) + assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/d/e/f"), bug6977) + assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/c/d/e/f"), bug6977) + assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/b/c/d/e/f"), bug6977) + assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/c/?/e/f"), bug6977) + assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/c/**/d/e/f"), bug6977) + assert_equal(["a/b/c/d/e/f"], Dir.glob("a/**/c/**/d/e/f"), bug6977) + end + end + def test_foreach assert_equal(Dir.foreach(@root).to_a.sort, %w(. ..) + (?a..?z).to_a) end |