tests: allow specifying 'at least 1 occurrence' for assert_output_contains

This commit is contained in:
Jose Diaz-Gonzalez
2025-12-25 18:29:02 -05:00
parent ca51f2de01
commit 3a476716eb

View File

@@ -148,6 +148,14 @@ assert_output_contains() {
input="${input/$expected/}"
found=$((found + 1))
done
if [[ "$count" -eq -1 ]]; then
if [[ "$found" -gt 0 ]]; then
return 0
fi
flunk "expected at least 1 occurrence of '$expected', found $found"
fi
[[ "$count" -eq "$found" ]] || flunk "expected $count occurrences of '$expected', found $found"
}