Added Message-Id to messages in test suite.
[mmh] / test / repl / test-repl
1 #!/bin/sh
2 ######################################################
3 #
4 # Test repl
5 #
6 ######################################################
7
8 # This is not a comprehensive test of repl, but some day it will be :-)
9 # Please add to it.
10
11 set -e
12
13 if test -z "${MH_OBJ_DIR}"; then
14     srcdir=`dirname $0`/../..
15     MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
16 fi
17
18 . "$MH_OBJ_DIR/test/common.sh"
19
20 setup_test
21
22 expected=$MH_TEST_DIR/$$.expected
23 actual=$MH_TEST_DIR/Mail/draft
24
25
26 # check -help
27 cat >$expected <<EOF
28 Usage: repl: [+folder] [msg] [switches]
29   switches are:
30   -[no]group
31   -[no]annotate
32   -cc all|to|cc|me
33   -nocc type
34   -draftfolder +folder
35   -draftmessage msg
36   -nodraftfolder
37   -editor editor
38   -noedit
39   -fcc folder
40   -filter filterfile
41   -form formfile
42   -([no]forma)t
43   -[no]inplace
44   -[no]mime
45   -[no]query
46   -whatnowproc program
47   -nowhatnowproc
48   -width columns
49   -version
50   -help
51   -(file) file
52   -(build)
53   -[no]atfile
54   -fmtproc program
55   -nofmtproc
56 EOF
57
58 repl -help >$actual 2>&1
59 check $expected $actual
60
61 # check -version
62 case `repl -v` in
63   repl\ --*) ;;
64   *        ) printf '%s: repl -v generated unexpected output\n' "$0" >&2
65              failed=`expr ${failed:-0} + 1`;;
66 esac
67
68 # check unknown switch
69 run_test "repl -nonexistent" 'repl: -nonexistent unknown'
70
71 # check with no switches
72 run_test "repl" 'repl: no cur message'
73
74
75 printf 'Local-Mailbox: mymailbox@localhost\n' >> $MH
76
77 # check -cc me
78 cat >$expected <<EOF
79 From: mymailbox@localhost
80 To: Test1 <test1@example.com>
81 cc: mymailbox@localhost
82 Fcc: +outbox
83 Subject: Re: Testing message 1
84 In-reply-to: 1@test.nmh
85 References: 1@test.nmh
86 Comments: In-reply-to Test1 <test1@example.com>
87    message dated "Fri, 29 Sep 2006 00:00:00."
88 --------
89 EOF
90
91 repl -cc me -editor true -nowhatnowproc 1
92 check $expected $actual
93
94 # check -nocc me
95 cat >$expected <<EOF
96 From: mymailbox@localhost
97 To: Test1 <test1@example.com>
98 cc: 
99 Fcc: +outbox
100 Subject: Re: Testing message 1
101 In-reply-to: 1@test.nmh
102 References: 1@test.nmh
103 Comments: In-reply-to Test1 <test1@example.com>
104    message dated "Fri, 29 Sep 2006 00:00:00."
105 --------
106 EOF
107
108 repl -cc me -nocc me -editor true -nowhatnowproc 1
109 check $expected $actual
110
111 # check -cc me with Local- and Alternate-Mailbox addtions, Bug #36635:
112 # -nocc me doesn't account for Alternate-Mailboxes.
113 printf 'Alternate-Mailboxes: user@example.com\n' >> $MH
114
115 cat >$expected <<EOF
116 From: mymailbox@localhost
117 To: Test1 <test1@example.com>
118 cc: mymailbox@localhost
119 Fcc: +outbox
120 Subject: Re: Testing message 1
121 In-reply-to: 1@test.nmh
122 References: 1@test.nmh
123 Comments: In-reply-to Test1 <test1@example.com>
124    message dated "Fri, 29 Sep 2006 00:00:00."
125 --------
126 EOF
127
128 repl -cc me -editor true -nowhatnowproc 1
129 check $expected $actual
130
131
132 # check -nocc me with Local- and Alternate-Mailbox addtions, Bug #36635:
133 # -nocc me doesn't account for Alternate-Mailboxes.
134 cat >$expected <<EOF
135 From: mymailbox@localhost
136 To: Test1 <test1@example.com>
137 cc: 
138 Fcc: +outbox
139 Subject: Re: Testing message 1
140 In-reply-to: 1@test.nmh
141 References: 1@test.nmh
142 Comments: In-reply-to Test1 <test1@example.com>
143    message dated "Fri, 29 Sep 2006 00:00:00."
144 --------
145 EOF
146
147 repl -cc me -nocc me -editor true -nowhatnowproc 1
148 check $expected $actual
149
150
151 exit ${failed:-0}