1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#! /bin/sh
# Test production and execution of user's commands.
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
got="$MH_TEST_DIR"/$$.got
want="$MH_TEST_DIR"/$$.want
# The third word, if it exists, of the command executed is plucked as
# the name to display on the faulty assumption the arguments start ["sh",
# "-c"]. Plucking occurred for NULL in the past so test it here.
start_test 'plucking of third word for command'\''s display name'
email=`mhpath new`
cat >"$email" <<\E
From: foo@example.edu
MIME-Version: 1.0
Content-Type: text/foo
Date: Sun, 18 Dec 2005 00:52:39 +0100
E
cp "$MH" "$MH.orig"
cmd= argv2=
for w in false foo bar xyzzy; do
cmd="$cmd $w"
if test $w = bar; then argv2="$w: "; fi
cp "$MH.orig" "$MH"
echo "mhshow-show-text/foo: $cmd" >>"$MH"
set +e
#### map 255, which is the status on Solaris, to 1
run_prog mhshow last | sed 's/\(exited\) 255/\1 1/' >"$got" 2>&1
set -e
cat >"$want" <<\E
[ Message inbox:11 ]
Date: Sun, 18 Dec 2005 00:52:39 +0100
From: foo@example.edu
MIME-Version: 1.0
E
echo "${argv2}exited 1" >>"$want"
check "$want" "$got" : check "word $w"
done
mv "$MH.orig" "$MH"
finish_test
|