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