expectFailure 'fromSource null''lib.fileset.fromSource: The source origin of the argument is of type null, but it should be a path instead.'
expectFailure 'fromSource (lib.cleanSource "")''lib.fileset.fromSource: The source origin of the argument is a string-like value \(""\), but it should be a path instead.
\s*Sources created from paths in strings cannot be turned into file sets, use `lib.sources` or derivations instead.'
expectFailure 'fromSource (lib.cleanSource null)''lib.fileset.fromSource: The source origin of the argument is of type null, but it should be a path instead.'
# fromSource on a path works and is the same as coercing that path
# If it's not in the source store path, it's also not in the file set store path
if[[-e"$filesetStorePath"/"$subpath"]];then
die "The store path $sourceStorePath created by $expr doesn't contain $subpath, but the corresponding store path $filesetStorePath created via fromSource does contain $subpath"
# If it's an empty directory in the source store path, it shouldn't be in the file set store path
if[[-e"$filesetStorePath"/"$subpath"]];then
die "The store path $sourceStorePath created by $expr contains the path $subpath without any files, but the corresponding store path $filesetStorePath created via fromSource didn't omit it"
fi
else
# If it's non-empty directory or a file, it should be in the file set store path
if[[!-e"$filesetStorePath"/"$subpath"]];then
die "The store path $sourceStorePath created by $expr contains the non-empty path $subpath, but the corresponding store path $filesetStorePath created via fromSource doesn't include it"
fi
fi
done < <(find .-mindepth 1 -print0)
rm-rf--*
}
# Check whether the filter is evaluated correctly
tree=(
[a]=
[b/]=
[b/c]=
[b/d]=
[e/]=
[e/e/]=
)
# We fill out the above tree values with all possible combinations of 0 and 1
# Then check whether a filter based on those return values gets turned into the corresponding file set
for i in$(seq 0 $((2**${#tree[@]}-1)));do
for p in"${!tree[@]}";do
tree[$p]=$(( i %2))
(( i /= 2 ))||true
done
checkSource
done
# The filter is called with the same arguments in the same order