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:
1 parent
b0bfb92831
commit
71301d1824
1 file changed
+1
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user