]>
diplodocus.org Git - nmh/blob - test/anno/test-anno
2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"$MH_OBJ_DIR/test/common.sh"
19 expected
=$MH_TEST_DIR/$$.expected
20 expected_err
=$MH_TEST_DIR/$$.expected_err
21 actual
=$MH_TEST_DIR/$$.actual
22 actual_err
=$MH_TEST_DIR/$$.actual_err
25 cat >"$expected" <<EOF
26 Usage: anno [+folder] [msgs] [switches]
42 anno
-help >"$actual" 2>&1
43 check
"$expected" "$actual"
48 * ) printf '%s: anno -v generated unexpected output\n' "$0" >&2
49 failed
=`expr ${failed:-0} + 1`;;
52 # check unknown switch
53 run_test
"anno -nonexistent" 'anno: -nonexistent unknown'
55 cat "${MH_TEST_DIR}/Mail/inbox/1" >"${MH_TEST_DIR}/Mail/inbox/11"
57 # check with no switches
58 printf 'Nmh-test:\n' >"$expected"
59 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
60 folder
-fast 1 >/dev
/null
62 printf 'Nmh-test' | anno
>/dev
/null
63 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
64 check
"$expected" "$actual" 'keep first'
65 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
68 anno
-component Nmh
-test
69 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
70 check
"$expected" "$actual" 'keep first'
71 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
74 anno
-component Nmh
-test +inbox
75 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
76 check
"$expected" "$actual" 'keep first'
77 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
80 folder
-fast 2 >/dev
/null
81 anno
1 -component Nmh
-test
82 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
83 check
"$expected" "$actual" 'keep first'
84 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
87 if [ $hard_links_supported -eq 1 ]; then
89 # Hard link the message and verify that the new one doesn't get annotated.
90 cp "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.copy"
91 ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
92 anno
8 -component Nmh
-test -noinplace
93 mv -f "${MH_TEST_DIR}/Mail/inbox/8.copy" "${MH_TEST_DIR}/Mail/inbox/8"
94 check
"${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" \
98 # 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 anno
8 -component Nmh
-test -noinplace -inplace
101 check
"${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
104 # check -nodate. Without -text, it doesn't change the message.
105 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "$expected-nodate"
106 anno
1 -component Nmh
-test -nodate
107 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
108 check
"$expected-nodate" "$actual"
109 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
112 anno
1 -component Nmh
-test -nodate -date
113 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
114 check
"$expected" "$actual" 'keep first'
115 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
118 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/draft"
119 anno
-draft -component Nmh
-test
120 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/draft" >"$actual"
121 check
"$expected" "$actual"
122 rm "${MH_TEST_DIR}/Mail/draft"
125 sed -s '4a\Nmh-test:' "${MH_TEST_DIR}/Mail/inbox/1" >"$expected"
126 anno
1 -component Nmh
-test -append
127 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
128 check
"$expected" "$actual"
129 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
132 printf 'Nmh-test: test of anno -list\n' >"$expected"
133 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
134 anno
1 -component Nmh
-test -nodate -text 'test of anno -list'
135 run_test
'anno 1 -component Nmh-test -list' 'test of anno -list'
137 check
"$expected" "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
138 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
140 # check -list -number
141 printf 'Nmh-test: test of anno -list -number\n' >"$expected"
142 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
143 anno
1 -component Nmh
-test -nodate -text 'test of anno -list -number'
144 run_test
'anno 1 -component Nmh-test -list -number' \
145 '1 test of anno -list -number'
146 check
"$expected" "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
147 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
150 cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
151 anno
1 -component Nmh
-test
152 anno
1 -component Nmh
-test -delete
153 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
154 check
"$expected" "$actual"
155 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
157 # check -delete -number
158 printf 'Nmh-test: 1\nNmh-test: 3\n' >"$expected"
159 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
160 anno
1 -component Nmh
-test -nodate -text 3
161 anno
1 -component Nmh
-test -nodate -text 2
162 anno
1 -component Nmh
-test -nodate -text 1
163 anno
1 -component Nmh
-test -delete -number 2
164 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
165 check
"$expected" "$actual"
166 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
169 cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
170 anno
1 -component Nmh
-test -nodate -text 3
171 anno
1 -component Nmh
-test -nodate -text 2
172 anno
1 -component Nmh
-test -nodate -text 1
173 anno
1 -component Nmh
-test -delete -number all
174 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
175 check
"$expected" "$actual"
176 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
179 touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/1"
180 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
181 anno
1 -component Nmh
-test -preserve
182 anno
1 -component Nmh
-test -preserve -delete
183 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls2"
184 check
"$actual-ls1" "$actual-ls2"
185 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
188 touch -t '2012100100.00' "${MH_TEST_DIR}/Mail/inbox/1"
189 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
190 anno
1 -component Nmh
-test -preserve -nopreserve
191 anno
1 -component Nmh
-test -preserve -nopreserve -delete
192 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls2"
194 diff "$actual-ls1" "$actual-ls2" >/dev
/null
195 run_test
'printf 1' "$?"
197 rm "$actual-ls1" "$actual-ls2"