From def6e1cee2b78f4bd8e2ac8591532e5c59ccd58d Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sat, 16 Jan 2021 14:38:28 +0000 Subject: [PATCH] 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. --- cmd/dovecot-auth-cli/dovecot-auth-cli.go | 1 - cmd/dovecot-auth-cli/test.sh | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/dovecot-auth-cli/dovecot-auth-cli.go b/cmd/dovecot-auth-cli/dovecot-auth-cli.go index 10248ec..2a01638 100644 --- a/cmd/dovecot-auth-cli/dovecot-auth-cli.go +++ b/cmd/dovecot-auth-cli/dovecot-auth-cli.go @@ -1,7 +1,6 @@ // CLI used for testing the dovecot authentication package. // // NOT for production use. -// +build !coverage package main diff --git a/cmd/dovecot-auth-cli/test.sh b/cmd/dovecot-auth-cli/test.sh index 4bb8c4f..c7dc23c 100755 --- a/cmd/dovecot-auth-cli/test.sh +++ b/cmd/dovecot-auth-cli/test.sh @@ -16,6 +16,11 @@ 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"