]>
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.
135 post: problem initializing server; [BHST] ready; I'll buy that for a dollar!
136 send: message not delivered to anyone
140 test_post
"${testname}.actual" "${testname}.expected" 2>"${testname}.err"
142 check
"${testname}.err" "${testname}.err.expected"
145 # 8-bit with 8BITMIME support
147 start_test
'8-bit with 8BITMIME support'
148 # Cheat: SMTPUTF8 enables 8BITMIME in fakestmp
149 SMTPUTF8
=1; export SMTPUTF8
150 cat > "${testname}.expected" <<EOF
151 EHLO nosuchhost.example.com
152 MAIL FROM:<nobody@example.com> BODY=8BITMIME
153 RCPT TO:<somebody@example.com>
155 From: Mr Nobody <nobody@example.com>
156 To: Somebody Else <somebody@example.com>
159 Content-Type: text/plain; charset="utf-8"
160 Content-Transfer-Encoding: 8bit
168 test_post
"${testname}.actual" "${testname}.expected"
172 # 8-bit with 8BITMIME support, inferred from content
174 start_test
'8-bit, inferred, with 8BITMIME support'
175 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
176 From: Mr Nobody <nobody@example.com>
177 To: Somebody Else <somebody@example.com>
180 Content-Type: text/plain; charset="utf-8"
182 This is a test, with a non-ascii character: §
186 cat > "${testname}.expected" <<EOF
187 EHLO nosuchhost.example.com
188 MAIL FROM:<nobody@example.com> BODY=8BITMIME
189 RCPT TO:<somebody@example.com>
191 From: Mr Nobody <nobody@example.com>
192 To: Somebody Else <somebody@example.com>
195 Content-Type: text/plain; charset="utf-8"
198 This is a test, with a non-ascii character: §
203 test_post
"${testname}.actual" "${testname}.expected"