]>
diplodocus.org Git - nmh/blob - test/post/test-post-basic
3 # Test the basic behavior of post
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir
=`dirname "$0"`/..
/..
10 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
13 .
"${srcdir}/test/post/test-post-common.sh"
15 check_exit
'-eq 1' "$MH_LIBEXEC_DIR/post" - # gcov
18 # Basic test - Simple message, single user, single recipient. Note that
19 # we test dot-stuffing here as well.
21 start_test
'simple message'
22 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
23 From: Mr Nobody <nobody@example.com>
24 To: Somebody Else <somebody@example.com>
31 cat > "${testname}.expected" <<EOF
32 EHLO nosuchhost.example.com
33 MAIL FROM:<nobody@example.com>
34 RCPT TO:<somebody@example.com>
36 From: Mr Nobody <nobody@example.com>
37 To: Somebody Else <somebody@example.com>
40 Content-Type: text/plain; charset="us-ascii"
49 test_post
"${testname}.actual" "${testname}.expected"
52 # Make sure a draft without a From: is rejected
54 start_test
'reject draft without a From:'
55 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
56 To: Somebody Else <somebody@example.com>
62 run_test
"send -draft -server 127.0.0.1 -port $localport" \
63 "post: message has no From: header
64 post: See default components files for examples
65 post: re-format message and try again
66 send: message not delivered to anyone"
69 # Make sure that empty Nmh-* header lines are ignored, and that post
70 # warns about non-empty ones.
72 start_test
'ignore Nmh-* header lines'
73 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
74 From: Mr Nobody <nobody@example.com>
75 To: Somebody Else <somebody@example.com>
77 Nmh-Unused: suppress this line
84 cat > "${testname}.expected" <<EOF
85 EHLO nosuchhost.example.com
86 MAIL FROM:<nobody@example.com>
87 RCPT TO:<somebody@example.com>
89 From: Mr Nobody <nobody@example.com>
90 To: Somebody Else <somebody@example.com>
93 Content-Type: text/plain; charset="us-ascii"
102 cat > "${testname}.expected_send_output" <<EOF
103 post: ignoring header line -- Nmh-Unused: suppress this line
106 test_post
"${testname}.actual" "${testname}.expected" \
107 >${testname}.send_output
2>&1
109 check
"${testname}.send_output" "${testname}.expected_send_output"
112 # 8-bit without 8BITMIME support
114 start_test
'8-bit without 8BITMIME support'
115 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
116 From: Mr Nobody <nobody@example.com>
117 To: Somebody Else <somebody@example.com>
120 Content-Type: text/plain; charset="utf-8"
121 Content-Transfer-Encoding: 8bit
127 cat > "${testname}.expected" <<EOF
128 EHLO nosuchhost.example.com
133 cat > "${testname}.err.expected" <<EOF
134 post: SMTP server does not support 8BITMIME, not sending.
135 Suggest encoding message for 7-bit transport by setting your
136 locale to C, and/or specifying *b64 in mhbuild directives.
137 post: problem initializing server; [BHST] ready; I'll buy that for a dollar!
138 send: message not delivered to anyone
142 test_post
"${testname}.actual" "${testname}.expected" 2>"${testname}.err"
144 check
"${testname}.err" "${testname}.err.expected"
147 # 8-bit with 8BITMIME support
149 start_test
'8-bit with 8BITMIME support'
150 # Cheat: SMTPUTF8 enables 8BITMIME in fakestmp
151 SMTPUTF8
=1; export SMTPUTF8
152 cat > "${testname}.expected" <<EOF
153 EHLO nosuchhost.example.com
154 MAIL FROM:<nobody@example.com> BODY=8BITMIME
155 RCPT TO:<somebody@example.com>
157 From: Mr Nobody <nobody@example.com>
158 To: Somebody Else <somebody@example.com>
161 Content-Type: text/plain; charset="utf-8"
162 Content-Transfer-Encoding: 8bit
170 test_post
"${testname}.actual" "${testname}.expected"
174 # 8-bit with 8BITMIME support, inferred from content
176 start_test
'8-bit, inferred, with 8BITMIME support'
177 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
178 From: Mr Nobody <nobody@example.com>
179 To: Somebody Else <somebody@example.com>
182 Content-Type: text/plain; charset="utf-8"
184 This is a test, with a non-ascii character: §
188 cat > "${testname}.expected" <<EOF
189 EHLO nosuchhost.example.com
190 MAIL FROM:<nobody@example.com> BODY=8BITMIME
191 RCPT TO:<somebody@example.com>
193 From: Mr Nobody <nobody@example.com>
194 To: Somebody Else <somebody@example.com>
197 Content-Type: text/plain; charset="utf-8"
200 This is a test, with a non-ascii character: §
205 test_post
"${testname}.actual" "${testname}.expected"