Browse files

Adds spec for directories with glob patterns

* Dir.[] and Dir.glob should be able to match these special directories.
  Passes under MRI, but currently fails under JRuby:
  jruby/jruby#172
  • Loading branch information...
1 parent 0233f4f commit 66926ef66e266b1aa3b15d37f16e0f18c5145165 @alindeman committed May 20, 2012
Showing with 11 additions and 0 deletions.
  1. +2 −0 core/dir/fixtures/common.rb
  2. +2 −0 core/dir/glob_spec.rb
  3. +7 −0 core/dir/shared/glob.rb
View
2 core/dir/fixtures/common.rb
@@ -80,6 +80,8 @@ def self.mock_dir_files
special/]
special/{
special/}
+
+ special/test{1}/file[1]
]
platform_is_not :windows do
View
2 core/dir/glob_spec.rb
@@ -67,6 +67,7 @@
deeply/nested/directory/structure/
dir/
special/
+ special/test{1}/
subdir_one/
subdir_two/
]
@@ -87,6 +88,7 @@
./deeply/nested/directory/structure/
./dir/
./special/
+ ./special/test{1}/
./subdir_one/
./subdir_two/
]
View
7 core/dir/shared/glob.rb
@@ -102,6 +102,10 @@
Dir.send(@method, 'special/\}').should == ['special/}']
end
+ it "matches paths with glob patterns" do
+ Dir.send(@method, 'special/test\{1\}/*').should == ['special/test{1}/file[1]']
+ end
+
it "matches dotfiles with '.*'" do
Dir.send(@method, '.*').sort.should == %w|. .. .dotfile .dotsubdir|.sort
end
@@ -160,6 +164,7 @@
deeply/nested/directory/structure/
dir/
special/
+ special/test{1}/
subdir_one/
subdir_two/
]
@@ -251,6 +256,8 @@
nondotfile
+ special/test{1}/file[1]
+
subdir_one/nondotfile
subdir_two/nondotfile
subdir_two/nondotfile.ext]

0 comments on commit 66926ef

Please sign in to comment.