]> diplodocus.org Git - nmh/blob - test/post/test-post-basic
If -[no]concat is given to show(1), have it use showmimeproc instead
[nmh] / test / post / test-post-basic
1 #!/bin/sh
2 #
3 # Test the basic behavior of post
4 #
5
6 set -e
7
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir=`dirname "$0"`/../..
10 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
11 fi
12
13 . "${srcdir}/test/post/test-post-common.sh"
14
15 #
16 # Basic test - Simple message, single user, single recipient. Note that
17 # we test dot-stuffing here as well.
18 #
19
20 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
21 From: Mr Nobody <nobody@example.com>
22 To: Somebody Else <somebody@example.com>
23 Subject: Test
24
25 This is a test
26 .
27 EOF
28
29 cat > "${testname}.expected" <<EOF
30 EHLO nosuchhost.example.com
31 MAIL FROM:<nobody@example.com>
32 RCPT TO:<somebody@example.com>
33 DATA
34 From: Mr Nobody <nobody@example.com>
35 To: Somebody Else <somebody@example.com>
36 Subject: Test
37 MIME-Version: 1.0
38 Content-Type: text/plain; charset="us-ascii"
39 Date:
40
41 This is a test
42 ..
43 .
44 QUIT
45 EOF
46
47 test_post "${testname}.actual" "${testname}.expected"
48
49 #
50 # Make sure a draft without a From: is rejected
51 #
52
53 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
54 To: Somebody Else <somebody@example.com>
55 Subject: Blank Test
56
57 This is a blank test
58 EOF
59
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"
65
66 #
67 # Make sure that empty Nmh-* header lines are ignored, and that post
68 # warns about non-empty ones.
69 #
70 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
71 From: Mr Nobody <nobody@example.com>
72 To: Somebody Else <somebody@example.com>
73 Nmh-Attachment:
74 Nmh-Unused: suppress this line
75 Subject: Test
76
77 This is a test
78 .
79 EOF
80
81 cat > "${testname}.expected" <<EOF
82 EHLO nosuchhost.example.com
83 MAIL FROM:<nobody@example.com>
84 RCPT TO:<somebody@example.com>
85 DATA
86 From: Mr Nobody <nobody@example.com>
87 To: Somebody Else <somebody@example.com>
88 Subject: Test
89 MIME-Version: 1.0
90 Content-Type: text/plain; charset="us-ascii"
91 Date:
92
93 This is a test
94 ..
95 .
96 QUIT
97 EOF
98
99 cat > "${testname}.expected_send_output" <<EOF
100 post: ignoring header line -- Nmh-Unused: suppress this line
101 EOF
102
103 test_post "${testname}.actual" "${testname}.expected" \
104 >${testname}.send_output 2>&1
105
106 check "${testname}.send_output" "${testname}.expected_send_output"
107
108
109 exit ${failed:-0}