]>
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 expected
=$MH_TEST_DIR/$$.expected
20 expected_err
=$MH_TEST_DIR/$$.expected_err
21 actual
=$MH_TEST_DIR/$$.actual
22 actual_err
=$MH_TEST_DIR/$$.actual_err
27 Usage: prompter [switches] file
38 #### Skip nmh intro text.
39 run_prog prompter
-help | sed '/^$/,$d' >"$actual" 2>&1
40 check
"$expected" "$actual"
45 * ) printf '%s: prompter -v generated unexpected output\n' "$0" >&2
46 failed
=`expr ${failed:-0} + 1`;;
49 # check unknown switch
50 run_test
'prompter -nonexistent' 'prompter: -nonexistent unknown'
53 # check with no switches
54 run_test
'prompter' 'prompter: usage: prompter [switches] file'
58 Resent-From: sender@example.com
59 Resent-To: recipient@example.com
60 Resent-cc: cc@example.com
66 cat >$MH_TEST_DIR/prompter
-file <<EOF
67 Resent-From: sender@example.com
73 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
74 run_prog prompter
$MH_TEST_DIR/prompter
-file >/dev
/null
76 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
79 cat >$MH_TEST_DIR/prompter
-file <<EOF
80 Resent-From: sender@example.com
86 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n.\n' | \
87 run_prog prompter
-doteof $MH_TEST_DIR/prompter
-file >/dev
/null
89 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
92 cat >$MH_TEST_DIR/prompter
-file <<EOF
93 Resent-From: sender@example.com
99 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
100 run_prog prompter
-doteof -nodoteof $MH_TEST_DIR/prompter
-file >/dev
/null
102 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
105 cat >$MH_TEST_DIR/prompter
-file <<EOF
106 Resent-From: sender@example.com
114 printf 'appendage\n' >>"$expected"
116 printf 'recipient@example.com\ncc@example.com\n+outbox\nappendage\n' | \
117 run_prog prompter
-noprepend $MH_TEST_DIR/prompter
-file >/dev
/null
119 check
"$expected" "$MH_TEST_DIR/prompter-file"
122 cat >$MH_TEST_DIR/prompter
-file <<EOF
123 Resent-From: sender@example.com
132 Resent-From: sender@example.com
133 Resent-To: recipient@example.com
134 Resent-cc: cc@example.com
141 printf 'recipient@example.com\ncc@example.com\n+outbox\nprependage\n' | \
142 run_prog prompter
-noprepend -prepend $MH_TEST_DIR/prompter
-file >/dev
/null
144 check
"$MH_TEST_DIR/prompter-file" "$expected" 'keep first'
148 Resent-From: sender@example.com
149 Resent-To: recipient@example.com
150 Resent-cc: cc@example.com
153 --------Enter initial text
158 run_prog prompter
-rapid $MH_TEST_DIR/prompter
-file >"$actual" </dev
/null
160 check
"$expected" "$actual"
164 Resent-From: sender@example.com
165 Resent-To: recipient@example.com
166 Resent-cc: cc@example.com
169 --------Enter initial text
176 run_prog prompter
-rapid -norapid $MH_TEST_DIR/prompter
-file \
177 >"$actual" </dev
/null
179 check
"$expected" "$actual"
181 # check -erase and -kill. We can't test their effects because they
182 # only affect the terminal and this test execution might not be
183 # connected to one. So we can just check that the respective options
186 erase ^U, kill ^?, intr ^@
187 Resent-From: sender@example.com
188 Resent-To: recipient@example.com
189 Resent-cc: cc@example.com
192 --------Enter initial text
199 printf 'woot woot\n' | \
200 run_prog prompter
-erase '\15' -kill '\7f' $MH_TEST_DIR/prompter
-file >"$actual"
202 check
"$expected" "$actual"
204 # check -body. It's undocumented but the default, so make sure that
205 # it reverses the effect of -nobody.
207 Resent-From: sender@example.com
208 Resent-To: recipient@example.com
209 Resent-cc: cc@example.com
212 --------Enter initial text
220 run_prog prompter
-nobody -body $MH_TEST_DIR/prompter
-file >"$actual" \
223 check
"$expected" "$actual"
225 # check -nobody. It's undocumented but looks like it removes the body.
227 Resent-From: sender@example.com
228 Resent-To: recipient@example.com
229 Resent-cc: cc@example.com
233 run_prog prompter
-nobody $MH_TEST_DIR/prompter
-file >/dev
/null
235 check
"$expected" "$MH_TEST_DIR/prompter-file"