Rearranged test suite environment variables so that individual tests
[mmh] / test / whatnow / test-attach-detach
1 #!/bin/sh
2 ######################################################
3 #
4 # Test that whatnow's "ls" copes with directory names
5 # which have spaces in them (see bug #23319)
6 #
7 ######################################################
8
9 if test -z "${MH_OBJ_DIR}"; then
10     srcdir=`dirname $0`/../..
11     MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
12 fi
13
14 . "$MH_OBJ_DIR/test/common.sh"
15
16 setup_test
17
18 set -e
19
20 cd "$MH_TEST_DIR"
21 rm -f "baz's boz"
22 touch "baz's boz"
23 # whatnow's attach stuff needs a draft to work on
24 cp "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/draft"
25
26 expectederr=$MH_TEST_DIR/$$.expectederr
27 actualerr=$MH_TEST_DIR/$$.actualerr
28 expected=$MH_TEST_DIR/$$.expected
29 actual=$MH_TEST_DIR/$$.actual
30
31 rm -f $expected $expectederr $actual $actualerr
32 touch $expected $expectederr $actual $actualerr
33
34 cat > $expected <<EOF
35 baz's boz
36 EOF
37
38 # whatnow's exit status is always 1 so that is not a failure
39 set +e
40 echo "attach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
41 echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
42 echo "detach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
43 echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
44 set -e
45
46 diff -u $expectederr $actualerr || exit 1
47 diff -u $expected $actual