tests/libtest.sh: Print non-matching file on failure

We clean up the temporary directory on failure, which means it's hard
to know *why* a regex didn't match.  Print it when we hit an error.

Closes: #383
Approved by: mbarnes
This commit is contained in:
Colin Walters 2016-07-07 17:36:08 -04:00 committed by Atomic Bot
parent b0bfb92831
commit 71301d1824
1 changed files with 1 additions and 0 deletions

View File

@ -138,6 +138,7 @@ assert_file_has_content () {
if ! grep -q -e "$2" "$1"; then if ! grep -q -e "$2" "$1"; then
sed -e 's/^/# /' < "$1" >&2 sed -e 's/^/# /' < "$1" >&2
echo 1>&2 "File '$1' doesn't match regexp '$2'" echo 1>&2 "File '$1' doesn't match regexp '$2'"
cat $1
exit 1 exit 1
fi fi
} }