diff options
Diffstat (limited to 'lib/fileset/tests.sh')
-rwxr-xr-x | lib/fileset/tests.sh | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/fileset/tests.sh b/lib/fileset/tests.sh index 5ef155d25a881..ebf9b6c37bf23 100755 --- a/lib/fileset/tests.sh +++ b/lib/fileset/tests.sh @@ -813,14 +813,15 @@ checkFileset 'difference ./. ./b' # The first argument needs to be a function expectFailure 'fileFilter null (abort "this is not needed")' 'lib.fileset.fileFilter: First argument is of type null, but it should be a function instead.' -# The second argument can be a file set or an existing path -expectFailure 'fileFilter (file: abort "this is not needed") null' 'lib.fileset.fileFilter: Second argument is of type null, but it should be a file set or a path instead.' +# The second argument needs to be an existing path +expectFailure 'fileFilter (file: abort "this is not needed") _emptyWithoutBase' 'lib.fileset.fileFilter: Second argument is a file set, but it should be a path instead. +\s*If you need to filter files in a file set, use `intersection fileset \(fileFilter pred \./\.\)` instead.' +expectFailure 'fileFilter (file: abort "this is not needed") null' 'lib.fileset.fileFilter: Second argument is of type null, but it should be a path instead.' expectFailure 'fileFilter (file: abort "this is not needed") ./a' 'lib.fileset.fileFilter: Second argument \('"$work"'/a\) is a path that does not exist.' # The predicate is not called when there's no files tree=() checkFileset 'fileFilter (file: abort "this is not needed") ./.' -checkFileset 'fileFilter (file: abort "this is not needed") _emptyWithoutBase' # The predicate must be able to handle extra attributes touch a @@ -882,14 +883,6 @@ checkFileset 'union ./c/a (fileFilter (file: assert file.name != "a"; true) ./.) # but here we need to use ./c checkFileset 'union (fileFilter (file: assert file.name != "a"; true) ./.) ./c' -# Also lazy, the filter isn't called on a filtered out path -tree=( - [a]=1 - [b]=0 - [c]=0 -) -checkFileset 'fileFilter (file: assert file.name != "c"; file.name == "a") (difference ./. ./c)' - # Make sure single files are filtered correctly tree=( [a]=1 |