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 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 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 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 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 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 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 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 prompter -rapid -norapid $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
177 check "$expected" "$actual"
179 # check -erase and -kill. We can't test their effects because they
180 # only affect the terminal and this test execution might not be
181 # connected to one. So we can just check that the respective options
184 erase ^U, kill ^?, intr ^@
185 Resent-From: sender@example.com
186 Resent-To: recipient@example.com
187 Resent-cc: cc@example.com
190 --------Enter initial text
197 printf 'woot woot\n' | \
198 prompter -erase '
\15' -kill '
\7f' $MH_TEST_DIR/prompter-file > "$actual"
200 check "$expected" "$actual"
202 # check -body. It's undocumented but the default, so make sure that
203 # it reverses the effect of -nobody.
205 Resent-From: sender@example.com
206 Resent-To: recipient@example.com
207 Resent-cc: cc@example.com
210 --------Enter initial text
218 prompter -nobody -body $MH_TEST_DIR/prompter-file > "$actual" < /dev/null
220 check "$expected" "$actual"
222 # check -nobody. It's undocumented but looks like it removes the body.
224 Resent-From: sender@example.com
225 Resent-To: recipient@example.com
226 Resent-cc: cc@example.com
230 prompter -nobody $MH_TEST_DIR/prompter-file > /dev/null
232 check "$expected" "$MH_TEST_DIR/prompter-file"