summary refs log tree commit diff
path: root/lib/fileset/tests.sh
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2023-11-16 09:49:24 +0100
committerVladimír Čunát <v@cunat.cz>2023-11-16 09:49:24 +0100
commit0fe5300699182cd6e2d6f6e2459671e6d5ffd69b (patch)
tree5e3fca0a82505733a631130889fe9756c5e8b5e5 /lib/fileset/tests.sh
parent1181aa74bcba03558eb18db93823a70305ddc56d (diff)
parent826934df9a5935635740a31afec804d0369c5a66 (diff)
downloadnixpkgs-0fe5300699182cd6e2d6f6e2459671e6d5ffd69b.tar
nixpkgs-0fe5300699182cd6e2d6f6e2459671e6d5ffd69b.tar.gz
nixpkgs-0fe5300699182cd6e2d6f6e2459671e6d5ffd69b.tar.bz2
nixpkgs-0fe5300699182cd6e2d6f6e2459671e6d5ffd69b.tar.lz
nixpkgs-0fe5300699182cd6e2d6f6e2459671e6d5ffd69b.tar.xz
nixpkgs-0fe5300699182cd6e2d6f6e2459671e6d5ffd69b.tar.zst
nixpkgs-0fe5300699182cd6e2d6f6e2459671e6d5ffd69b.zip
Merge branch 'master' into staging-next
Diffstat (limited to 'lib/fileset/tests.sh')
-rwxr-xr-xlib/fileset/tests.sh15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/fileset/tests.sh b/lib/fileset/tests.sh
index 5ef155d25a8..ebf9b6c37bf 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