testsuite.at 3.86 KB
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
# Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

m4_include([testsuite.inc])

dnl ------------------------------------------------------------
dnl mailbox for comsatd
m4_pushdef([BIFF_MBOX],[`pwd`/mailbox])

dnl ------------------------------------------------------------
dnl comsatcmd
m4_pushdef([comsatcmd],[comsatd --no-site --no-user --file ./biff.rc dnl
 --set logging.syslog=no --test])

dnl ------------------------------------------------------------
dnl BIFFTEST(DESCR, KW, DATA, CMDLINE, [STDOUT = `'], [STDERR = `'])
dnl
m4_pushdef([BIFFTEST],[
AT_SETUP([comsatd: $1])
AT_KEYWORDS([comsatd $2])
$3
AT_CHECK([$4],[0],[$5],[$6])
AT_CLEANUP])

AT_INIT

AT_TESTED([comsatd])

MUT_VERSION(comsatd)

BIFFTEST([default commands],[comsatd00],
[cwd=`pwd`
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/teaparty.mbox, mailbox)
cat > biff.rc <<EOT
tty $cwd/output
default
EOT
chmod 600 biff.rc
> $cwd/output
],
[comsatcmd $cwd/mailbox 0
sed '1s/^Mail to .*/Mail to test user/' output
],
[Mail to test user
---
From: March Hare  <hare@wonder.land>
Subject: Invitation
---
Have some wine


---
])

BIFFTEST([non-zero qid],[comsatd01],
[cwd=`pwd`
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/teaparty.mbox, mailbox)
cat > biff.rc <<EOT
tty $cwd/output
default
EOT
chmod 600 biff.rc
> $cwd/output
],
[comsatcmd $cwd/mailbox 9367
sed '1s/^Mail to .*/Mail to test user/' output
],
[Mail to test user
---
From: Alice  <alice@wonder.land>
Subject: Funny watch (was Re: Watch)
---
What a funny watch! It tells the day of the
month, and doesn't tell what o'clock it is!


---
])

BIFFTEST([maildir qid],[comsatd02],
[cwd=`pwd`
MUT_MBCOPY($abs_top_srcdir/testsuite/maildir/teaparty, mailbox)
cat > biff.rc <<EOT
tty $cwd/output
default
EOT
chmod 600 biff.rc
> $cwd/output
],
[comsatcmd maildir:$cwd/mailbox new/1284627340.M364969P3770Q81.Trurl
sed '1s/^Mail to .*/Mail to test user/' output
],
[Mail to test user
---
From: Alice  <alice@wonder.land>
Subject: Re: Story
---
What did they draw?

---
])


BIFFTEST([MH qid],[comsatd03],
[cwd=`pwd`
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty, mailbox)
cat > biff.rc <<EOT
tty $cwd/output
default
EOT
chmod 600 biff.rc
> $cwd/output
],
[comsatcmd mh:$cwd/mailbox teaparty/58
sed '1s/^Mail to .*/Mail to test user/' output
],
[Mail to test user
---
From: March Hare  <hare@wonder.land>
Subject: Request for a story (was Re: A guess)
---
Suppose we change the subject, I'm getting tired of this.
I vote the young lady tells us a story.

---
])

BIFFTEST([beep command],[comsatd04],
[cwd=`pwd`
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox1, mailbox)
cat > biff.rc <<EOT
tty $cwd/output
beep
EOT
chmod 600 biff.rc
> $cwd/output
],
[comsatcmd $cwd/mailbox 0
cat output | tr '\a' A
],
[AA])

BIFFTEST([exec command],[comsatd05],
[cwd=`pwd`
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/teaparty.mbox, mailbox)
AT_DATA([notifier],[#! /bin/sh
echo "You have mail from $1, regarding $2"
])
chmod +x notifier
cat > biff.rc <<EOT
tty $cwd/output
exec $cwd/notifier '\$H{from}' '\$H{Subject}'
EOT
chmod 600 biff.rc
> $cwd/output
],
[comsatcmd $cwd/mailbox 0
cat output
],
[You have mail from March Hare  <hare@wonder.land>, regarding Invitation
])

m4_popdef([BIFFTEST])
m4_popdef([comsatcmd])
m4_popdef([BIFF_MBOX])