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:
Nik Everett 2017-12-12 11:07:33 -05:00
parent 2994366195
commit cc1a301b5e
1 changed files with 5 additions and 0 deletions

View File

@ -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