ignore_file accepts shell glob (*, **)
+ test of this new behaviour
This commit is contained in:
parent
d3d884a2f1
commit
d5f29a821c
@ -56,7 +56,13 @@ module Cmdtest
|
||||
end
|
||||
|
||||
def _ignore_file?(path)
|
||||
@ignored_files.any? {|ignored| ignored === path }
|
||||
@ignored_files.any? do |ignored|
|
||||
if ignored.index("*")
|
||||
File.fnmatch(ignored, path, File::FNM_PATHNAME)
|
||||
else
|
||||
ignored === path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def files
|
||||
|
@ -109,4 +109,26 @@ class CMDTEST_ignore_file < Cmdtest::Testcase
|
||||
end
|
||||
end
|
||||
|
||||
#----------------------------------------
|
||||
# the argument to 'ignore_file' can contain shell wildcards,
|
||||
# both * and **
|
||||
|
||||
def test_ignore_file_SHELL_GLOB
|
||||
create_CMDTEST_foo [
|
||||
"ignore_file 'bbb*'",
|
||||
"ignore_file '**/ccc'",
|
||||
"dir_mkdir 'dir'",
|
||||
"",
|
||||
"cmd 'touch.rb aaa bbb1 bbb2 ccc dir/aaa dir/bbb1 dir/bbb2 dir/ccc' do",
|
||||
" created_files 'aaa', 'dir/aaa', 'dir/bbb1', 'dir/bbb2'",
|
||||
"end",
|
||||
]
|
||||
|
||||
cmd_cmdtest do
|
||||
stdout_equal [
|
||||
"### touch.rb aaa bbb1 bbb2 ccc dir/aaa dir/bbb1 dir/bbb2 dir/ccc",
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user