Skip to content

Commit

Permalink
libtest: Support matching multiple regexps in files
Browse files Browse the repository at this point in the history
For a future patch.

Closes: #652
Approved by: jlebon
  • Loading branch information
cgwalters authored and rh-atomic-bot committed May 12, 2017
1 parent 3fae2ea commit 17626d2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/common/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ assert_not_has_dir () {
}

assert_file_has_content () {
if ! grep -q -e "$2" "$1"; then
sed -e 's/^/# /' < "$1" >&2
echo 1>&2 "File '$1' doesn't match regexp '$2'"
exit 1
fi
fpath=$1
shift
for re in $@; do
if ! grep -q -e "$re" "$fpath"; then
sed -e 's/^/# /' < "$1" >&2
echo 1>&2 "File '$1' doesn't match regexp '$2'"
exit 1
fi
done
}

assert_file_empty() {
Expand Down

0 comments on commit 17626d2

Please sign in to comment.