]>
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 run_prog prompter
-help >$actual 2>&1
39 check
$expected $actual
44 * ) printf '%s: prompter -v generated unexpected output\n' "$0" >&2
45 failed
=`expr ${failed:-0} + 1`;;
48 # check unknown switch
49 run_test
'prompter -nonexistent' 'prompter: -nonexistent unknown'
52 # check with no switches
53 run_test
'prompter' 'prompter: usage: prompter [switches] file'
57 Resent-From: sender@example.com
58 Resent-To: recipient@example.com
59 Resent-cc: cc@example.com
65 cat >$MH_TEST_DIR/prompter
-file <<EOF
66 Resent-From: sender@example.com
72 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
73 run_prog prompter
$MH_TEST_DIR/prompter
-file >/dev
/null
75 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
78 cat >$MH_TEST_DIR/prompter
-file <<EOF
79 Resent-From: sender@example.com
85 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n.\n' | \
86 run_prog prompter
-doteof $MH_TEST_DIR/prompter
-file >/dev
/null
88 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
91 cat >$MH_TEST_DIR/prompter
-file <<EOF
92 Resent-From: sender@example.com
98 printf 'recipient@example.com\ncc@example.com\n+outbox\nmessage body\n' | \
99 run_prog prompter
-doteof -nodoteof $MH_TEST_DIR/prompter
-file >/dev
/null
101 check
"$expected" "$MH_TEST_DIR/prompter-file" 'keep first'
104 cat >$MH_TEST_DIR/prompter
-file <<EOF
105 Resent-From: sender@example.com
113 printf 'appendage\n' >>"$expected"
115 printf 'recipient@example.com\ncc@example.com\n+outbox\nappendage\n' | \
116 run_prog prompter
-noprepend $MH_TEST_DIR/prompter
-file >/dev
/null
118 check
"$expected" "$MH_TEST_DIR/prompter-file"
121 cat >$MH_TEST_DIR/prompter
-file <<EOF
122 Resent-From: sender@example.com
131 Resent-From: sender@example.com
132 Resent-To: recipient@example.com
133 Resent-cc: cc@example.com
140 printf 'recipient@example.com\ncc@example.com\n+outbox\nprependage\n' | \
141 run_prog prompter
-noprepend -prepend $MH_TEST_DIR/prompter
-file >/dev
/null
143 check
"$MH_TEST_DIR/prompter-file" "$expected" 'keep first'
147 Resent-From: sender@example.com
148 Resent-To: recipient@example.com
149 Resent-cc: cc@example.com
152 --------Enter initial text
157 run_prog prompter
-rapid $MH_TEST_DIR/prompter
-file >"$actual" </dev
/null
159 check
"$expected" "$actual"
163 Resent-From: sender@example.com
164 Resent-To: recipient@example.com
165 Resent-cc: cc@example.com
168 --------Enter initial text
175 run_prog prompter
-rapid -norapid $MH_TEST_DIR/prompter
-file \
176 >"$actual" </dev
/null
178 check
"$expected" "$actual"
180 # check -erase and -kill. We can't test their effects because they
181 # only affect the terminal and this test execution might not be
182 # connected to one. So we can just check that the respective options
185 erase ^U, kill ^?, intr ^@
186 Resent-From: sender@example.com
187 Resent-To: recipient@example.com
188 Resent-cc: cc@example.com
191 --------Enter initial text
198 printf 'woot woot\n' | \
199 run_prog prompter
-erase '\15' -kill '\7f' $MH_TEST_DIR/prompter
-file >"$actual"
201 check
"$expected" "$actual"
203 # check -body. It's undocumented but the default, so make sure that
204 # it reverses the effect of -nobody.
206 Resent-From: sender@example.com
207 Resent-To: recipient@example.com
208 Resent-cc: cc@example.com
211 --------Enter initial text
219 run_prog prompter
-nobody -body $MH_TEST_DIR/prompter
-file >"$actual" \
222 check
"$expected" "$actual"
224 # check -nobody. It's undocumented but looks like it removes the body.
226 Resent-From: sender@example.com
227 Resent-To: recipient@example.com
228 Resent-cc: cc@example.com
232 run_prog prompter
-nobody $MH_TEST_DIR/prompter
-file >/dev
/null
234 check
"$expected" "$MH_TEST_DIR/prompter-file"