1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00
Files
go-chasquid-smtp/cmd/dovecot-auth-cli/test.sh
Alberto Bertogli def6e1cee2 dovecot-auth-cli: Test invalid arguments handling
This patch adds a minor test to dovecot-auth-cli to verify that the
check for invalid number of arguments is working as expected.

It's mostly for consistency, as the utility is only used for testing
purposes.
2021-01-16 23:21:35 +00:00

34 lines
783 B
Bash
Executable File

#!/bin/bash
set -e
. $(dirname ${0})/../../test/util/lib.sh
init
# Build the binary once, so we can use it and launch it in chamuyero scripts.
# Otherwise, we not only spend time rebuilding it over and over, but also "go
# run" masks the exit code, which is something we care about.
if [ "${COVER_DIR}" != "" ]; then
go test -covermode=count -coverpkg=../../... -c \
$GOFLAGS -tags="coveragebin $GOTAGS"
cp coverage_wrapper dovecot-auth-cli
else
go build $GOFLAGS -tags="$GOTAGS" dovecot-auth-cli.go
fi
if ! ./dovecot-auth-cli lalala 2>&1 | grep -q "invalid arguments"; then
echo "cli worked with invalid arguments"
exit 1
fi
for i in *.cmy; do
if ! chamuyero $i > $i.log 2>&1 ; then
echo "# Test $i failed, log follows"
cat $i.log
exit 1
fi
done
success
exit 0