]>
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"
16 # Basic test - Simple message, single user, single recipient. Note that
17 # we test dot-stuffing here as well.
19 start_test
'simple message'
20 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
21 From: Mr Nobody <nobody@example.com>
22 To: Somebody Else <somebody@example.com>
29 cat > "${testname}.expected" <<EOF
30 EHLO nosuchhost.example.com
31 MAIL FROM:<nobody@example.com>
32 RCPT TO:<somebody@example.com>
34 From: Mr Nobody <nobody@example.com>
35 To: Somebody Else <somebody@example.com>
38 Content-Type: text/plain; charset="us-ascii"
47 test_post
"${testname}.actual" "${testname}.expected"
50 # Make sure a draft without a From: is rejected
52 start_test
'reject draft without a From:'
53 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
54 To: Somebody Else <somebody@example.com>
60 run_test
"send -draft -server 127.0.0.1 -port $localport" \
61 "post: message has no From: header
62 post: See default components files for examples
63 post: re-format message and try again
64 send: message not delivered to anyone"
67 # Make sure that empty Nmh-* header lines are ignored, and that post
68 # warns about non-empty ones.
70 start_test
'ignore Nmh-* header lines'
71 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
72 From: Mr Nobody <nobody@example.com>
73 To: Somebody Else <somebody@example.com>
75 Nmh-Unused: suppress this line
82 cat > "${testname}.expected" <<EOF
83 EHLO nosuchhost.example.com
84 MAIL FROM:<nobody@example.com>
85 RCPT TO:<somebody@example.com>
87 From: Mr Nobody <nobody@example.com>
88 To: Somebody Else <somebody@example.com>
91 Content-Type: text/plain; charset="us-ascii"
100 cat > "${testname}.expected_send_output" <<EOF
101 post: ignoring header line -- Nmh-Unused: suppress this line
104 test_post
"${testname}.actual" "${testname}.expected" \
105 >${testname}.send_output
2>&1
107 check
"${testname}.send_output" "${testname}.expected_send_output"
110 # 8-bit without 8BITMIME support
112 start_test
'8-bit without 8BITMIME support'
113 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
114 From: Mr Nobody <nobody@example.com>
115 To: Somebody Else <somebody@example.com>
118 Content-Type: text/plain; charset="utf-8"
119 Content-Transfer-Encoding: 8bit
125 cat > "${testname}.expected" <<EOF
126 EHLO nosuchhost.example.com
131 cat > "${testname}.err.expected" <<EOF
132 post: SMTP server does not support 8BITMIME, not sending.
133 Suggest encoding message for 7-bit transport by setting your
134 locale to C, and/or specifying *b64 in mhbuild directives.
136 post: problem initializing server; [BHST] ready; I'll buy that for a dollar!
137 send: message not delivered to anyone
141 test_post
"${testname}.actual" "${testname}.expected" 2>"${testname}.err"
143 check
"${testname}.err" "${testname}.err.expected"
146 # 8-bit with 8BITMIME support
148 start_test
'8-bit with 8BITMIME support'
149 # Cheat: SMTPUTF8 enables 8BITMIME in fakestmp
150 SMTPUTF8
=1; export SMTPUTF8
151 cat > "${testname}.expected" <<EOF
152 EHLO nosuchhost.example.com
153 MAIL FROM:<nobody@example.com> BODY=8BITMIME
154 RCPT TO:<somebody@example.com>
156 From: Mr Nobody <nobody@example.com>
157 To: Somebody Else <somebody@example.com>
160 Content-Type: text/plain; charset="utf-8"
161 Content-Transfer-Encoding: 8bit
169 test_post
"${testname}.actual" "${testname}.expected"
173 # 8-bit with 8BITMIME support, inferred from content
175 start_test
'8-bit, inferred, with 8BITMIME support'
176 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
177 From: Mr Nobody <nobody@example.com>
178 To: Somebody Else <somebody@example.com>
181 Content-Type: text/plain; charset="utf-8"
183 This is a test, with a non-ascii character: §
187 cat > "${testname}.expected" <<EOF
188 EHLO nosuchhost.example.com
189 MAIL FROM:<nobody@example.com> BODY=8BITMIME
190 RCPT TO:<somebody@example.com>
192 From: Mr Nobody <nobody@example.com>
193 To: Somebody Else <somebody@example.com>
196 Content-Type: text/plain; charset="utf-8"
199 This is a test, with a non-ascii character: §
204 test_post
"${testname}.actual" "${testname}.expected"