tests/libtest-core: support multiple literal checks
`grep` supports checking multiple fixed strings separated by newlines, but it's mostly just easier to pass them as separate arguments, so let's support that. This is now at parity with the similar `assert_file_has_content`. Will upstream this to ostree as well once reviewed. Closes: #1200 Approved by: cgwalters
This commit is contained in:
parent
9f7511a5d8
commit
738fbc633b
@ -105,9 +105,12 @@ assert_file_has_content () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert_file_has_content_literal () {
|
assert_file_has_content_literal () {
|
||||||
if ! grep -q -F -e "$2" "$1"; then
|
fpath=$1; shift
|
||||||
_fatal_print_file "$1" "File '$1' doesn't match fixed string list '$2'"
|
for s in "$@"; do
|
||||||
fi
|
if ! grep -q -F -e "$s" "$fpath"; then
|
||||||
|
_fatal_print_file "$fpath" "File '$fpath' doesn't match fixed string list '$s'"
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_symlink_has_content () {
|
assert_symlink_has_content () {
|
||||||
|
Loading…
Reference in New Issue
Block a user