]>
diplodocus.org Git - nmh/blob - test/whatnow/test-attach-detach
2 ######################################################
4 # Test that whatnow's "ls" copes with directory names
5 # which have spaces in them (see bug #23319)
7 ######################################################
11 if test -z "${MH_OBJ_DIR}"; then
12 srcdir
=`dirname "$0"`/..
/..
13 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
16 .
"$MH_OBJ_DIR/test/common.sh"
20 # Set TERM to get consistent output.
21 TERM
=dumb
; export TERM
25 testname_quoted
="baz\'s\ boz"
27 # whatnow's attach stuff needs a draft to work on
28 cp "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/draft"
30 expectederr
=$MH_TEST_DIR/$$.expectederr
31 actualerr
=$MH_TEST_DIR/$$.actualerr
32 expected
=$MH_TEST_DIR/$$.expected
33 actual
=$MH_TEST_DIR/$$.actual
35 rm -f $expected $expectederr $actual $actualerr
36 touch $expected $expectederr $actual $actualerr
39 # Sigh. Different readline versions change echoing behavior, so we need
44 whatnowtest
=`echo cd | whatnow -prompt ''`
47 case ${whatnowtest} in
48 cd) cat >"$expected" <<EOF
49 attach $testname_quoted
52 detach $testname_quoted
57 "") cat >"$expected" <<EOF
62 *) echo "Unknown response to whatnow readline test"
63 echo "Response is: ${whatnowtest}"
68 # whatnow's exit status is always 1 so that is not a failure
70 echo "attach $testname_quoted" | \
71 run_prog whatnow
-attach foo
-noedit -prompt '' 2>>$actualerr >>$actual
73 run_prog whatnow
-attach foo
-noedit -prompt '' 2>>$actualerr >>$actual
74 echo "detach $testname_quoted" | \
75 run_prog whatnow
-attach foo
-noedit -prompt '' 2>>$actualerr >>$actual
77 run_prog whatnow
-attach foo
-noedit -prompt '' 2>>$actualerr >>$actual
80 check
"$expectederr" "$actualerr"
81 check
"$expected" "$actual"
83 if [ "$readline" = 0 ]; then
84 cat >"$expected" <<EOF
86 What now? whatnow: attach command requires file argument(s).
88 What now? whatnow: attach command requires file argument(s).
90 What now? whatnow: ignoring attach -a without format argument.
91 whatnow: attach command requires file argument(s).
93 What now? whatnow: attach command requires file argument(s).
95 What now? whatnow: ignoring attach -a without format argument.
96 whatnow: attach command requires file argument(s).
98 What now? whatnow: ignoring attach -a without format argument.
99 whatnow: attach command requires file argument(s).
101 What now? whatnow: attach command requires file argument(s).
104 What now? whatnow: ignoring attach -a without format argument.
105 #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
107 What now? whatnow: ingoring invalid attachformat value of 3
108 #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
110 What now? #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
112 What now? #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
114 What now? #text/plain; name="context"; x-unix-mode=0600 [ ASCII text ] ${MH_TEST_DIR}/Mail/context
119 cat >"$expected" <<EOF
122 whatnow: attach command requires file argument(s).
125 whatnow: attach command requires file argument(s).
128 whatnow: ignoring attach -a without format argument.
129 whatnow: attach command requires file argument(s).
132 whatnow: attach command requires file argument(s).
135 whatnow: ignoring attach -a without format argument.
136 whatnow: attach command requires file argument(s).
139 whatnow: ignoring attach -a without format argument.
140 whatnow: attach command requires file argument(s).
143 whatnow: attach command requires file argument(s).
145 What now? at -a 0 Mail/context
147 What now? at -v -a Mail/context
148 whatnow: ignoring attach -a without format argument.
149 #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
151 What now? at -v -a 3 Mail/context
152 whatnow: ingoring invalid attachformat value of 3
153 #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
155 What now? at -v Mail/context
156 #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
158 What now? at -v -a 1 Mail/context
159 #text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
161 What now? at -v -a 0 Mail/context
162 #text/plain; name="context"; x-unix-mode=0600 [ ASCII text ] ${MH_TEST_DIR}/Mail/context
164 What now? quit -delete
168 # Don't depend on the mode of Mail/context:
169 chmod 0600 ${MH_TEST_DIR}/Mail
/context
180 'at -a 0 Mail/context' \
181 'at -v -a Mail/context' \
182 'at -v -a 3 Mail/context' \
183 'at -v Mail/context' \
184 'at -v -a 1 Mail/context' \
185 'at -v -a 0 Mail/context' \
186 'quit -delete' | whatnow
2>&1 | sed -e 's/; charset=us-ascii//' >"$actual"
189 #### Without readline, need to add trailing newline.
190 [ "$readline" = 0 ] && printf '\n' >>"$actual"
192 check
"$expected" "$actual"
194 test ${failed:-0} -eq 0 && rm "$testname"