#! /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 run_prog mhshow last >"$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