test/common.sh: new file for common utility functions for the test scripts.
[mmh] / test / tests / 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 set -e
10
11 cd "$MH_TEST_DIR"
12 rm -f "baz's boz"
13 touch "baz's boz"
14 # whatnow's attach stuff needs a draft to work on
15 cp "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/draft"
16
17 expectederr=$MH_TEST_DIR/$$.expectederr
18 actualerr=$MH_TEST_DIR/$$.actualerr
19 expected=$MH_TEST_DIR/$$.expected
20 actual=$MH_TEST_DIR/$$.actual
21
22 rm -f $expected $expectederr $actual $actualerr
23 touch $expected $expectederr $actual $actualerr
24
25 cat > $expected <<EOF
26 baz's boz
27 EOF
28
29 # whatnow's exit status is always 1 so that is not a failure
30 set +e
31 echo "attach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
32 echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
33 echo "detach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
34 echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
35 set -e
36
37 diff -u $expectederr $actualerr
38 diff -u $expected $actual