#!/bin/sh

d=$(dirname "$0")
cd "${d}" || exit 1
. ./helper-functions.sh || exit 1

log "Comparing generated emails to $d/multimail.expect ..."

./generate-test-emails 2>&1 | ./filter-noise >/tmp/multimail.actual
GIT_PAGER=cat git diff -u multimail.expect /tmp/multimail.actual
if test $? -ne 0
then
    fatal "
===========================================================================
FAILURE!
Please investigate the discrepancies shown above.
If you are sure that your version is correct, then please

    cp /tmp/multimail.actual $d/multimail.expect

and commit."
fi
