Re-work the test suite so it now works with Automake (via "make check").
[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 [ -z "${MH_TEST_COMMON}" ]; then
10     echo "MH_TEST_COMMON not set; try running via 'make check'"
11 fi
12
13 . ${MH_TEST_COMMON}
14
15 setup_test
16
17 set -e
18
19 cd "$MH_TEST_DIR"
20 rm -f "baz's boz"
21 touch "baz's boz"
22 # whatnow's attach stuff needs a draft to work on
23 cp "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/draft"
24
25 expectederr=$MH_TEST_DIR/$$.expectederr
26 actualerr=$MH_TEST_DIR/$$.actualerr
27 expected=$MH_TEST_DIR/$$.expected
28 actual=$MH_TEST_DIR/$$.actual
29
30 rm -f $expected $expectederr $actual $actualerr
31 touch $expected $expectederr $actual $actualerr
32
33 cat > $expected <<EOF
34 baz's boz
35 EOF
36
37 # whatnow's exit status is always 1 so that is not a failure
38 set +e
39 echo "attach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
40 echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
41 echo "detach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
42 echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
43 set -e
44
45 diff -u $expectederr $actualerr || exit 1
46 diff -u $expected $actual