X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/eba408368603a3afe170ef61a334c3a479ea5a29..403805faa7a8564c103801891b5abf33974767ad:/test/slocal/test-slocal diff --git a/test/slocal/test-slocal b/test/slocal/test-slocal index eafe3139..72860e86 100755 --- a/test/slocal/test-slocal +++ b/test/slocal/test-slocal @@ -17,7 +17,9 @@ fi setup_test # Use proper program, maybe not the first one on PATH. -slocal="$MH_LIB_DIR"/slocal +slocal="$MH_LIBEXEC_DIR"/slocal + +check_exit '-eq 1' $slocal - expected="$MH_TEST_DIR"/$$.expected actual="$MH_TEST_DIR"/$$.actual @@ -25,6 +27,7 @@ actual2="$MH_TEST_DIR"/$$.actual2 md="$MH_TEST_DIR"/Mail/maildelivery # check -help +start_test "-help" cat >"$expected" <"$actual" 2>&1 +#### Skip nmh intro text. +run_prog $slocal -help 2>&1 | sed '/^$/,$d' >"$actual" check "$expected" "$actual" # check -version +start_test "-version" case `$slocal -vers` in slocal\ --*) ;; * ) printf '%s: slocal -vers generated unexpected output\n' "$0" >&2 @@ -53,143 +58,202 @@ case `$slocal -vers` in esac # check unknown switch +start_test "unknown switch" run_test "$slocal -nonexistent" 'slocal: -nonexistent unknown' # check non-switch argument +start_test "non-switch argument" run_test "$slocal nonexistent" 'slocal: only switch arguments are supported' +# If no mail spool, explicitly specify the mailbox. +if grep 'mmdfldir:.*/dev/null' ${MHMTSCONF}.old >/dev/null; then + mbox="-mailbox ${MH_TEST_DIR}/Mail/mbox" +else + mbox= +fi + +#### Need to specify full path to tee on Cygwin. +[ -x /usr/bin/tee ] && tee=/usr/bin/tee || tee=tee + # check basic operation +start_test "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 <"$md" <"$actual2" 2>&1 +start_test "-debug" +run_prog $slocal -debug -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \ + >"$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.' +start_test "-verbose" +run_prog $slocal -verbose -maildelivery "$md" $mbox \ + <"$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 +start_test "-noverbose" +run_prog $slocal -verbose -noverbose -maildelivery "$md" $mbox \ + <"$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" <"$md" <$md <"$md" <$md <"$md" <$md <"$md" <$md <"$md" <$md <"$md" <