diff options
Diffstat (limited to '.ci/local/test.sh')
-rwxr-xr-x | .ci/local/test.sh | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/.ci/local/test.sh b/.ci/local/test.sh index f0500e4..6216c48 100755 --- a/.ci/local/test.sh +++ b/.ci/local/test.sh @@ -130,26 +130,25 @@ cgitize() { python3 -m cgitize.main --config "$cgitize_conf_path" } -check_contains() ( - # No pipefail so that grep doesn't fuck everything up: - # https://mywiki.wooledge.org/BashPitfalls#pipefail - - set -o errexit -o nounset - +check_contains() { if [ "$#" -lt 1 ]; then echo "usage: ${FUNCNAME[0]} TEST_STRING [PATTERN...]" >&2 return 1 fi + local test_string="$1" shift + local pattern for pattern; do - if ! echo "$test_string" | grep --fixed-strings --silent -- "$pattern"; then + # Be careful to _not_ use grep -q, since this fucks stuff up: + # https://mywiki.wooledge.org/BashPitfalls#pipefail. + if ! echo "$test_string" | grep --fixed-strings -- "$pattern" > /dev/null; then echo "${FUNCNAME[0]}: couldn't find the following pattern: $pattern" >&2 return 1 fi done -) +} verify_commits() { # This is fucking stupid, but otherwise stuff like `if verify_commits;` |