]>
diplodocus.org Git - nmh/blob - test/prompter/test-prompter
2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"$MH_OBJ_DIR/test/common.sh"
19 check_exit
'-eq 1' prompter
-
21 expected
=$MH_TEST_DIR/$$.expected
22 expected_err
=$MH_TEST_DIR/$$.expected_err
23 actual
=$MH_TEST_DIR/$$.actual
24 actual_err
=$MH_TEST_DIR/$$.actual_err
30 Usage: prompter [switches] file
41 #### Skip nmh intro text.
42 run_prog prompter
-help 2>&1 | sed '/^$/,$d' >"$actual"
43 check
"$expected" "$actual"
49 * ) printf '%s: prompter -v generated unexpected output\n' "$0" >&2
50 failed
=`expr ${failed:-0} + 1`;;
53 # check unknown switch
54 start_test
"unknown switch"
55 run_test
'prompter -nonexistent' 'prompter: -nonexistent unknown'
58 # check with no switches
59 start_test
"with no switches"
60 run_test
'prompter' 'prompter: usage: prompter [switches] file'
63 start_test
"with file"
65 Resent-From: sender@example.com
66 Resent-To: recipient@example.com
67 Resent-cc: cc@example.com
73 cat >$MH_TEST_DIR/prompter
-file <<EOF
74 Resent-From: sender@example.com
80 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
81 run_prog prompter
$MH_TEST_DIR/prompter
-file >/dev
/null
83 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
87 cat >$MH_TEST_DIR/prompter
-file <<EOF
88 Resent-From: sender@example.com
94 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n.\n' | \
95 run_prog prompter
-doteof $MH_TEST_DIR/prompter
-file >/dev
/null
97 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
100 start_test
"-nodoteof"
101 cat >$MH_TEST_DIR/prompter
-file <<EOF
102 Resent-From: sender@example.com
108 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
109 run_prog prompter
-doteof -nodoteof $MH_TEST_DIR/prompter
-file >/dev
/null
111 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
114 start_test
"-noprepend"
115 cat >$MH_TEST_DIR/prompter
-file <<EOF
116 Resent-From: sender@example.com
124 printf 'appendage\n' >>"$expected"
126 printf 'recipient@example.com\ncc@example.com\n+outbox\nappendage\n' | \
127 run_prog prompter
-noprepend $MH_TEST_DIR/prompter
-file >/dev
/null
129 check
"$expected" "$MH_TEST_DIR/prompter-file"
132 start_test
"-prepend"
133 cat >$MH_TEST_DIR/prompter
-file <<EOF
134 Resent-From: sender@example.com
143 Resent-From: sender@example.com
144 Resent-To: recipient@example.com
145 Resent-cc: cc@example.com
152 printf 'recipient@example.com\ncc@example.com\n+outbox\nprependage\n' | \
153 run_prog prompter
-noprepend -prepend $MH_TEST_DIR/prompter
-file >/dev
/null
155 check
"$MH_TEST_DIR/prompter-file" "$expected" 'keep first'
160 Resent-From: sender@example.com
161 Resent-To: recipient@example.com
162 Resent-cc: cc@example.com
165 --------Enter initial text
170 run_prog prompter
-rapid $MH_TEST_DIR/prompter
-file >"$actual" </dev
/null
172 check
"$expected" "$actual"
175 start_test
"-norapid"
177 Resent-From: sender@example.com
178 Resent-To: recipient@example.com
179 Resent-cc: cc@example.com
182 --------Enter initial text
189 run_prog prompter
-rapid -norapid $MH_TEST_DIR/prompter
-file \
190 >"$actual" </dev
/null
192 check
"$expected" "$actual"
194 # check -erase and -kill. We can't test their effects because they
195 start_test
"-erase and -kill. We can't test their effects because they"
196 # only affect the terminal and this test execution might not be
197 # connected to one. So we can just check that the respective options
200 erase ^U, kill ^?, intr ^@
201 Resent-From: sender@example.com
202 Resent-To: recipient@example.com
203 Resent-cc: cc@example.com
206 --------Enter initial text
213 printf 'woot woot\n' | \
214 run_prog prompter
-erase '\15' -kill '\7f' $MH_TEST_DIR/prompter
-file >"$actual"
216 check
"$expected" "$actual"
218 # check -body. It's undocumented but the default, so make sure that
219 start_test
"-body. It's undocumented but the default, so make sure that"
220 # it reverses the effect of -nobody.
222 Resent-From: sender@example.com
223 Resent-To: recipient@example.com
224 Resent-cc: cc@example.com
227 --------Enter initial text
235 run_prog prompter
-nobody -body $MH_TEST_DIR/prompter
-file >"$actual" \
238 check
"$expected" "$actual"
240 # check -nobody. It's undocumented but looks like it removes the body.
241 start_test
"-nobody. It's undocumented but looks like it removes the body."
243 Resent-From: sender@example.com
244 Resent-To: recipient@example.com
245 Resent-cc: cc@example.com
249 run_prog prompter
-nobody $MH_TEST_DIR/prompter
-file >/dev
/null
251 check
"$expected" "$MH_TEST_DIR/prompter-file"