From: David Levine Date: Fri, 23 Nov 2012 15:27:44 +0000 (-0600) Subject: Added test-slocal. X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=eba408368603a3afe170ef61a334c3a479ea5a29 Added test-slocal. --- diff --git a/Makefile.am b/Makefile.am index e6a6256..40bae41 100644 --- a/Makefile.am +++ b/Makefile.am @@ -75,6 +75,7 @@ TESTS = test/ali/test-ali test/anno/test-anno \ test/repl/test-multicomp test/repl/test-repl \ test/scan/test-scan test/scan/test-scan-multibyte \ test/sequences/test-flist test/sequences/test-mark \ + test/slocal/test-slocal \ test/whatnow/test-attach-detach test/whatnow/test-cd \ test/whatnow/test-ls test/whom/test-whom \ test/cleanup ## The "cleanup" test should always be last. diff --git a/test/slocal/test-slocal b/test/slocal/test-slocal new file mode 100755 index 0000000..eafe313 --- /dev/null +++ b/test/slocal/test-slocal @@ -0,0 +1,195 @@ +#!/bin/sh +###################################################### +# +# Test slocal +# +###################################################### + +set -e + +if test -z "$MH_OBJ_DIR"; then + srcdir=`dirname $0`/../.. + MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR +fi + +. "$MH_OBJ_DIR/test/common.sh" + +setup_test + +# Use proper program, maybe not the first one on PATH. +slocal="$MH_LIB_DIR"/slocal + +expected="$MH_TEST_DIR"/$$.expected +actual="$MH_TEST_DIR"/$$.actual +actual2="$MH_TEST_DIR"/$$.actual2 +md="$MH_TEST_DIR"/Mail/maildelivery + +# check -help +cat >"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +# check -version +case `$slocal -vers` in + slocal\ --*) ;; + * ) printf '%s: slocal -vers generated unexpected output\n' "$0" >&2 + failed=`expr ${failed:-0} + 1`;; +esac + +# check unknown switch +run_test "$slocal -nonexistent" 'slocal: -nonexistent unknown' + +# check non-switch argument +run_test "$slocal nonexistent" 'slocal: only switch arguments are supported' + +# check basic operation +# Can't use rcvstore because slocal wipes out the environment. +# So, it would put the message in the user's inbox, not the +# test inbox. slocal also freopens stdout and stderr to +# /dev/null, so we can't view them to verify simulated delivery. +cat >$md <"$actual2" 2>&1 +run_test "grep ^retrieving $actual2" 'retrieving message from stdin' + +# check -verbose +$slocal -verbose -maildelivery $md <"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1 +run_test "grep ^delivering $actual2" 'delivering to pipe "tee", success.' + +# check -noverbose +$slocal -verbose -noverbose -maildelivery $md <"$MH_TEST_DIR"/Mail/inbox/1 \ + >"$actual2" 2>&1 +run_test "grep ^delivering $actual2" '' +rm -f "$actual2" + +# check match of From +cat >$md <$md <$md <$md <$md <$md <$md <$md <$md <$md <