#!/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 <