diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-11-27 14:55:31 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-11-27 14:55:31 +0100 |
commit | f02d2f82bf10351f480ea312f40cb840e2437f93 (patch) | |
tree | 0b53098bffe6dacadb09880183ebcaea06e95153 /spec/ruby/core/dir | |
parent | f0bfa266d70651dc295a63b026938b246693499b (diff) | |
download | ruby-f02d2f82bf10351f480ea312f40cb840e2437f93.tar.gz |
Update to ruby/spec@ac878ad
Diffstat (limited to 'spec/ruby/core/dir')
-rw-r--r-- | spec/ruby/core/dir/fixtures/common.rb | 3 | ||||
-rw-r--r-- | spec/ruby/core/dir/glob_spec.rb | 16 | ||||
-rw-r--r-- | spec/ruby/core/dir/shared/glob.rb | 3 |
3 files changed, 22 insertions, 0 deletions
diff --git a/spec/ruby/core/dir/fixtures/common.rb b/spec/ruby/core/dir/fixtures/common.rb index 96dba56c93..71b1438b72 100644 --- a/spec/ruby/core/dir/fixtures/common.rb +++ b/spec/ruby/core/dir/fixtures/common.rb @@ -36,6 +36,8 @@ module DirSpecs .dotfile .dotsubdir/.dotfile .dotsubdir/nondotfile + nested/.dotsubir/.dotfile + nested/.dotsubir/nondotfile deeply/.dotfile deeply/nested/.dotfile.ext @@ -160,6 +162,7 @@ module DirSpecs dir_filename_ordering file_one.ext file_two.ext + nested nondotfile special subdir_one diff --git a/spec/ruby/core/dir/glob_spec.rb b/spec/ruby/core/dir/glob_spec.rb index d4888ee147..9b6e2b2d3d 100644 --- a/spec/ruby/core/dir/glob_spec.rb +++ b/spec/ruby/core/dir/glob_spec.rb @@ -59,6 +59,8 @@ describe "Dir.glob" do deeply/nested/directory/ deeply/nested/directory/structure/ dir/ + nested/ + nested/.dotsubir/ special/ special/test{1}/ subdir_one/ @@ -68,6 +70,18 @@ describe "Dir.glob" do Dir.glob('**/', File::FNM_DOTMATCH).sort.should == expected end + it "recursively matches files and directories in nested dot subdirectory with 'nested/**/*' from the current directory and option File::FNM_DOTMATCH" do + expected = %w[ + nested/. + nested/.dotsubir + nested/.dotsubir/. + nested/.dotsubir/.dotfile + nested/.dotsubir/nondotfile + ] + + Dir.glob('nested/**/*', File::FNM_DOTMATCH).sort.should == expected.sort + end + # This is a separate case to check **/ coming after a constant # directory as well. it "recursively matches any subdirectories except './' or '../' with '**/' and option File::FNM_DOTMATCH" do @@ -80,6 +94,8 @@ describe "Dir.glob" do ./deeply/nested/directory/ ./deeply/nested/directory/structure/ ./dir/ + ./nested/ + ./nested/.dotsubir/ ./special/ ./special/test{1}/ ./subdir_one/ diff --git a/spec/ruby/core/dir/shared/glob.rb b/spec/ruby/core/dir/shared/glob.rb index fcaa0d8a43..f6d41ba209 100644 --- a/spec/ruby/core/dir/shared/glob.rb +++ b/spec/ruby/core/dir/shared/glob.rb @@ -53,6 +53,7 @@ describe :dir_glob, shared: true do dir_filename_ordering file_one.ext file_two.ext + nested nondotfile special subdir_one @@ -156,6 +157,7 @@ describe :dir_glob, shared: true do dir_filename_ordering file_one.ext file_two.ext + nested nondotfile special subdir_one @@ -177,6 +179,7 @@ describe :dir_glob, shared: true do deeply/nested/directory/ deeply/nested/directory/structure/ dir/ + nested/ special/ special/test{1}/ subdir_one/ |