]>
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
29 Usage: prompter [switches] file
40 #### Skip nmh intro text.
41 run_prog prompter
-help | sed '/^$/,$d' >"$actual" 2>&1
42 check
"$expected" "$actual"
47 * ) printf '%s: prompter -v generated unexpected output\n' "$0" >&2
48 failed
=`expr ${failed:-0} + 1`;;
51 # check unknown switch
52 run_test
'prompter -nonexistent' 'prompter: -nonexistent unknown'
55 # check with no switches
56 run_test
'prompter' 'prompter: usage: prompter [switches] file'
60 Resent-From: sender@example.com
61 Resent-To: recipient@example.com
62 Resent-cc: cc@example.com
68 cat >$MH_TEST_DIR/prompter
-file <<EOF
69 Resent-From: sender@example.com
75 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
76 run_prog prompter
$MH_TEST_DIR/prompter
-file >/dev
/null
78 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
81 cat >$MH_TEST_DIR/prompter
-file <<EOF
82 Resent-From: sender@example.com
88 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n.\n' | \
89 run_prog prompter
-doteof $MH_TEST_DIR/prompter
-file >/dev
/null
91 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
94 cat >$MH_TEST_DIR/prompter
-file <<EOF
95 Resent-From: sender@example.com
101 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
102 run_prog prompter
-doteof -nodoteof $MH_TEST_DIR/prompter
-file >/dev
/null
104 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
107 cat >$MH_TEST_DIR/prompter
-file <<EOF
108 Resent-From: sender@example.com
116 printf 'appendage\n' >>"$expected"
118 printf 'recipient@example.com\ncc@example.com\n+outbox\nappendage\n' | \
119 run_prog prompter
-noprepend $MH_TEST_DIR/prompter
-file >/dev
/null
121 check
"$expected" "$MH_TEST_DIR/prompter-file"
124 cat >$MH_TEST_DIR/prompter
-file <<EOF
125 Resent-From: sender@example.com
134 Resent-From: sender@example.com
135 Resent-To: recipient@example.com
136 Resent-cc: cc@example.com
143 printf 'recipient@example.com\ncc@example.com\n+outbox\nprependage\n' | \
144 run_prog prompter
-noprepend -prepend $MH_TEST_DIR/prompter
-file >/dev
/null
146 check
"$MH_TEST_DIR/prompter-file" "$expected" 'keep first'
150 Resent-From: sender@example.com
151 Resent-To: recipient@example.com
152 Resent-cc: cc@example.com
155 --------Enter initial text
160 run_prog prompter
-rapid $MH_TEST_DIR/prompter
-file >"$actual" </dev
/null
162 check
"$expected" "$actual"
166 Resent-From: sender@example.com
167 Resent-To: recipient@example.com
168 Resent-cc: cc@example.com
171 --------Enter initial text
178 run_prog prompter
-rapid -norapid $MH_TEST_DIR/prompter
-file \
179 >"$actual" </dev
/null
181 check
"$expected" "$actual"
183 # check -erase and -kill. We can't test their effects because they
184 # only affect the terminal and this test execution might not be
185 # connected to one. So we can just check that the respective options
188 erase ^U, kill ^?, intr ^@
189 Resent-From: sender@example.com
190 Resent-To: recipient@example.com
191 Resent-cc: cc@example.com
194 --------Enter initial text
201 printf 'woot woot\n' | \
202 run_prog prompter
-erase '\15' -kill '\7f' $MH_TEST_DIR/prompter
-file >"$actual"
204 check
"$expected" "$actual"
206 # check -body. It's undocumented but the default, so make sure that
207 # it reverses the effect of -nobody.
209 Resent-From: sender@example.com
210 Resent-To: recipient@example.com
211 Resent-cc: cc@example.com
214 --------Enter initial text
222 run_prog prompter
-nobody -body $MH_TEST_DIR/prompter
-file >"$actual" \
225 check
"$expected" "$actual"
227 # check -nobody. It's undocumented but looks like it removes the body.
229 Resent-From: sender@example.com
230 Resent-To: recipient@example.com
231 Resent-cc: cc@example.com
235 run_prog prompter
-nobody $MH_TEST_DIR/prompter
-file >/dev
/null
237 check
"$expected" "$MH_TEST_DIR/prompter-file"