#! /bin/sh

set -e

printandrun()
{
        echo "$@"
        "$@"
}

printandexpectfail()
{
        echo "[SHOULD FAIL] $@"
        if "$@" ; then
		echo "command should have failed"
		exit 1
	else
		true
	fi
}

printandrun \
	./swaks -s localhost -tlso -f '<>' -t postmaster@localhost -q rcpt

printandrun \
	./swaks -tls -f '<>' \
		-t swaks@packages.debian.org -q ehlo

# Cannot check positive tls-cert verification against Debian servers
# since Debian SMTP SSL certs are not trusted by ca-certificates.

printandexpectfail \
	./swaks -tls --tls-verify --tls-ca-path `pwd` -f '<>' \
		-t swaks@packages.debian.org -q ehlo
