Packaging test: add guard for too many files
If you assert that a pattern of files exists but it matches more then one file the "assert this file exists" code failed with a misleading error message. This tests if the patter resolved to multiple files and prints a better error message if it did.
This commit is contained in:
parent
2994366195
commit
cc1a301b5e
|
@ -139,6 +139,11 @@ skip_not_zip() {
|
|||
|
||||
assert_file_exist() {
|
||||
local file="$1"
|
||||
local count=$(echo "$file" | wc -l)
|
||||
[[ "$count" == "1" ]] || {
|
||||
echo "assert_file_exist must be run on a single file at a time but was called on [$count] files: $file"
|
||||
false
|
||||
}
|
||||
if [ ! -e "$file" ]; then
|
||||
echo "Should exist: ${file} but does not"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue