2 ######################################################
6 ######################################################
12 runandcheck "anno -help" <<!
13 Usage: anno [+folder] [msgs] [switches]
31 * ) printf '%s: anno -V generated unexpected output\n' "$0" >&2
32 failed=`expr "${failed:-0}" + 1`;;
36 # check unknown switch
37 runandcheck "anno -nonexistent ||:" <<!
38 anno: -nonexistent unknown
42 cp "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
44 # check with no switches
46 runandcheck 'anno -comp Nmh-test 11' <<!
48 sed -e 's/^Nmh-test:.*/Nmh-test:/' "`mhpath 11`" >"`mhpath b`"
49 runandcheck "cat `mhpath l`" <<!
51 `cat "${MH_TEST_DIR}/Mail/inbox/1"`
53 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
58 runandcheck 'anno -component Nmh-test 11' <<!
60 sed -e 's/^Nmh-test:.*/Nmh-test:/' "`mhpath 11`" >"`mhpath b`"
61 runandcheck "cat `mhpath l`" <<!
63 `cat "${MH_TEST_DIR}/Mail/inbox/1"`
65 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
70 runandcheck 'anno -component Nmh-test +inbox 11' <<!
72 sed -e 's/^Nmh-test:.*/Nmh-test:/' "`mhpath 11`" >"`mhpath b`"
73 runandcheck "cat `mhpath l`" <<!
75 `cat "${MH_TEST_DIR}/Mail/inbox/1"`
77 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
84 folder -fast 2 >/dev/null
86 runandcheck "anno 11 -component Nmh-test" <<!
88 sed -e 's/^Nmh-test:.*/Nmh-test:/' "`mhpath 11`" >"`mhpath b`"
89 runandcheck "cat `mhpath l`" <<!
91 `cat "${MH_TEST_DIR}/Mail/inbox/1"`
93 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
97 # Hard link the message and verify that the new one does get annotated.
99 ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
100 runandcheck "anno 8 -component Nmh-test" <<!
102 runandcheck "diff -u $MH_TEST_DIR/Mail/inbox/8 $MH_TEST_DIR/Mail/inbox/8.link" <<!
106 # check -nodate. Without -text, it doesn't change the message.
108 runandcheck "anno 11 -component Nmh-test -nodate" <<!
109 anno: -nodate without -text is a no-op.
111 runandcheck "diff -u `mhpath f` `mhpath 11`" <<!
113 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
118 runandcheck "anno 11 -component Nmh-test -nodate -date" <<!
120 sed -e 's/^Nmh-test:.*/Nmh-test:/' "`mhpath 11`" >"`mhpath b`"
121 runandcheck "cat `mhpath l`" <<!
123 `cat "${MH_TEST_DIR}/Mail/inbox/1"`
125 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
131 runandcheck "anno 11 -component Nmh-test -append" <<!
133 sed -e 's/^Nmh-test:.*/Nmh-test:/' "`mhpath 11`" >"`mhpath b`"
134 runandcheck "cat `mhpath l`" <<!
135 `awk '/^$/{print "Nmh-test:"}1' "${MH_TEST_DIR}/Mail/inbox/1"`
137 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
142 runandcheck "anno 11 -component Nmh-test -nodate -text 'test of anno -list'" <<!
144 runandcheck "cat `mhpath 11`" <<!
145 Nmh-test: test of anno -list
146 `cat "${MH_TEST_DIR}/Mail/inbox/1"`
148 runandcheck 'anno 11 -component Nmh-test -list' <<!
151 # check -list -number
152 runandcheck 'anno 11 -component Nmh-test -list -number' <<!
155 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
160 runandcheck "anno 11 -component Nmh-test" <<!
162 runandcheck "anno 11 -component Nmh-test -delete" <<!
164 runandcheck "cat `mhpath 11`" <<!
165 `cat "$MH_TEST_DIR/Mail/inbox/1"`
167 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
170 # check -delete -number
171 anno 11 -component Nmh-test -nodate -text 3
172 anno 11 -component Nmh-test -nodate -text 2
173 anno 11 -component Nmh-test -nodate -text 1
174 runandcheck "anno 11 -component Nmh-test -delete -number 2" <<!
176 runandcheck "cat `mhpath 11`" <<!
179 `cat "$MH_TEST_DIR/Mail/inbox/1"`
181 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
185 anno 11 -component Nmh-test -nodate -text 3
186 anno 11 -component Nmh-test -nodate -text 2
187 anno 11 -component Nmh-test -nodate -text 1
188 runandcheck "anno 11 -component Nmh-test -delete -number all" <<!
190 runandcheck "cat `mhpath 11`" <<!
191 `cat "$MH_TEST_DIR/Mail/inbox/1"`
193 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
198 touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/11"
199 output="`ls -l \`mhpath 11\``"
200 runandcheck "anno 11 -component Nmh-test -preserve" <<!
202 runandcheck "anno 11 -component Nmh-test -preserve -delete" <<!
204 runandcheck "ls -l `mhpath 11`" <<!
207 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"
212 touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/11"
213 out1="`ls -l \`mhpath 11\``"
214 runandcheck "anno 11 -component Nmh-test -preserve -nopreserve" <<!
216 out2="`ls -l \`mhpath 11\``"
217 runandcheck "test \"$out1\" = \"$out2\" || echo differs" <<!
221 touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/11"
222 out1="`ls -l \`mhpath 11\``"
223 runandcheck "anno 11 -component Nmh-test -preserve -nopreserve -delete" <<!
225 out2="`ls -l \`mhpath 11\``"
226 runandcheck "test \"$out1\" = \"$out2\" || echo differs" <<!
229 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/inbox/11"