]>
diplodocus.org Git - nmh/blob - test/comp/test-draft-fcc
3 if test -z "${MH_OBJ_DIR}"; then
4 srcdir
=`dirname "$0"`/..
/..
5 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
8 .
"${MH_OBJ_DIR}/test/common.sh"
14 Local-Mailbox: norm@example.com
17 # Set this for the EHLO command
18 echo "clientname: nosuchhost.example.com" >> ${MHMTSCONF}
20 cat > "$MH_TEST_DIR/Mail/scan.dateless" <<EOF
21 %4(msg)%<(cur)+%| %>%<(unseen)U%| %>%<{replied}-%| %>\
22 %<(mymbox{from})%<{to}To:%(unquote(decode(friendly{to})))%>%>\
23 %<(zero)%(unquote(decode(friendly{from})))%> \
24 %(decode{subject})%<{body}<<%{body}>>%>
27 sbackup
="`mhparam sbackup`"
29 arith_eval
64000 + $$
% 1000
32 expected
="$MH_TEST_DIR/$$.expected"
33 actual
="$MH_TEST_DIR/$$.actual"
35 ################################################################################
36 start_test
'comp with Draft-Folder'
38 check_exit
'-eq 0' comp
-noedit -to phyl@example.com
-fcc sent
-subject test -nowhatnowproc < /dev
/null
40 ################################################################################
41 start_test
'scan +drafts shows the draft'
43 cat > "$expected" <<EOF
44 1+ To:phyl@example.com test
47 run_prog scan
-form scan.dateless
+drafts
> "$actual"
48 check
"$actual" "$expected"
50 ################################################################################
51 start_test
'send with Draft-Folder'
53 pid
=`"${MH_OBJ_DIR}/test/fakesmtp" /dev/null $smtp_port`
55 if ! (echo y
| check_exit
'-eq 0' send
-server 127.0.0.1 -port $smtp_port); then
56 failed
=`expr ${failed:-0} + 1`
58 kill $pid 2> /dev
/null
|| :
59 [ ${failed:-0} -eq 0 ]
61 ################################################################################
62 start_test
'drafts/.mh_sequences'
64 cat > "$expected" <<EOF
67 check
"`mhpath +drafts`/.mh_sequences" "$expected"
69 ################################################################################
70 start_test
'scan +drafts shows no messages'
72 cat > "$expected" <<EOF
73 scan: no messages in drafts
76 run_prog scan
-form scan.dateless
+drafts
> "$actual" 2>&1 || :
77 check
"$actual" "$expected"
79 ################################################################################
80 start_test
'scan +sent shows the sent message'
82 cat > "$expected" <<EOF
83 1 To:phyl@example.com test
86 run_prog scan
-form scan.dateless
+sent
> "$actual"
87 check
"$actual" "$expected"
89 ################################################################################
90 start_test
'drafts/,1.orig is the original draft'
92 cat > "$expected" <<EOF
93 From: norm@example.com
100 check
"`mhpath +drafts`/,1.orig" "$expected"
102 ################################################################################
103 start_test
'drafts/,1 is the post-mhbuild draft'
105 cat > "$expected" <<EOF
106 From: norm@example.com
112 Content-Type: text/plain
114 check
"`mhpath +drafts`/,1" "$expected"
116 ################################################################################
117 # Now test with -draftfolder.
118 # TODO Why are these different?!
119 ################################################################################
121 ################################################################################
122 start_test
'comp with Draft-Folder now for send -draftfolder'
124 check_exit
'-eq 0' comp
-noedit -to phyl@example.com
-fcc sent
-subject test2
-nowhatnowproc < /dev
/null
126 ################################################################################
127 start_test
'scan +drafts shows the draft now for send -draftfolder'
129 cat > "$expected" <<EOF
130 1+ To:phyl@example.com test2
133 run_prog scan
-form scan.dateless
+drafts
> "$actual"
134 check
"$actual" "$expected"
136 ################################################################################
137 start_test
'send -draftfolder'
139 pid
=`"${MH_OBJ_DIR}/test/fakesmtp" /dev/null $smtp_port`
141 if ! check_exit
'-eq 0' send
-draftfolder drafts
-server 127.0.0.1 -port $smtp_port < /dev
/null
; then
142 failed
=`expr ${failed:-0} + 1`
144 kill $pid 2> /dev
/null
|| :
145 [ ${failed:-0} -eq 0 ]
147 ################################################################################
148 start_test
'drafts/.mh_sequences'
150 cat > "$expected" <<EOF
153 check
"`mhpath +drafts`/.mh_sequences" "$expected"
155 ################################################################################
156 start_test
'scan +drafts shows no messages now for send -draftfolder'
158 cat > "$expected" <<EOF
159 scan: no messages in drafts
162 run_prog scan
-form scan.dateless
+drafts
> "$actual" 2>&1 || :
163 check
"$actual" "$expected"
165 ################################################################################
166 start_test
'scan +sent shows the sent message now for send -draftfolder'
168 cat > "$expected" <<EOF
169 1 To:phyl@example.com test
170 2 To:phyl@example.com test2
173 run_prog scan
-form scan.dateless
+sent
> "$actual"
174 check
"$actual" "$expected"
176 ################################################################################
177 start_test
"drafts/${sbackup}1.orig is the original draft now for send -draftfolder"
179 cat > "$expected" <<EOF
180 From: norm@example.com
187 check
"`mhpath +drafts`/${sbackup}1.orig" "$expected"
189 ################################################################################
190 start_test
"drafts/${sbackup}1 is the post-mhbuild draft now for send -draftfolder"
192 cat > "$expected" <<EOF
193 From: norm@example.com
199 Content-Type: text/plain
201 check
"`mhpath +drafts`/${sbackup}1" "$expected"