]>
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 check_exit
'-eq 1' anno
- # gcov
21 expected
=$MH_TEST_DIR/$$.expected
22 expected_err
=$MH_TEST_DIR/$$.expected_err
23 actual
=$MH_TEST_DIR/$$.actual
24 actual_err
=$MH_TEST_DIR/$$.actual_err
27 cat >"$expected" <<EOF
28 Usage: anno [+folder] [msgs] [switches]
44 #### Skip nmh intro text.
45 run_prog anno
-help | sed '/^$/,$d' >"$actual" 2>&1
46 check
"$expected" "$actual"
51 * ) printf '%s: anno -v generated unexpected output\n' "$0" >&2
52 failed
=`expr ${failed:-0} + 1`;;
55 # check unknown switch
56 run_test
"anno -nonexistent" 'anno: -nonexistent unknown'
58 cat "${MH_TEST_DIR}/Mail/inbox/1" >"${MH_TEST_DIR}/Mail/inbox/11"
60 # check with no switches
61 printf 'Nmh-test:\n' >"$expected"
62 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
63 folder
-fast 1 >/dev
/null
65 printf 'Nmh-test' | run_prog anno
>/dev
/null
66 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
67 check
"$expected" "$actual" 'keep first'
68 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
71 run_prog anno
-component Nmh
-test
72 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
73 check
"$expected" "$actual" 'keep first'
74 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
77 run_prog anno
-component Nmh
-test +inbox
78 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
79 check
"$expected" "$actual" 'keep first'
80 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
83 folder
-fast 2 >/dev
/null
84 run_prog anno
1 -component Nmh
-test
85 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
86 check
"$expected" "$actual" 'keep first'
87 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
90 if [ $hard_links_supported -eq 1 ]; then
92 # Hard link the message and verify that the new one doesn't get annotated.
93 cp "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.copy"
94 ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
95 run_prog anno
8 -component Nmh
-test -noinplace
96 mv -f "${MH_TEST_DIR}/Mail/inbox/8.copy" "${MH_TEST_DIR}/Mail/inbox/8"
97 check
"${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" \
101 # Hard link the message and verify that the new one does get annotated.
102 ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
103 run_prog anno
8 -component Nmh
-test -noinplace -inplace
104 check
"${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link"
107 # check -nodate. Without -text, it doesn't change the message.
108 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "$expected-nodate"
109 run_prog anno
1 -component Nmh
-test -nodate
110 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
111 check
"$expected-nodate" "$actual"
112 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
115 run_prog anno
1 -component Nmh
-test -nodate -date
116 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
117 check
"$expected" "$actual" 'keep first'
118 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
121 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/draft"
122 run_prog anno
-draft -component Nmh
-test
123 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/draft" >"$actual"
124 check
"$expected" "$actual"
125 rm "${MH_TEST_DIR}/Mail/draft"
128 sed -e 's/\(Subject: Testing message 1\)/\1\
129 Nmh-test:/' <"${MH_TEST_DIR}/Mail/inbox/1" >"$expected"
130 run_prog anno
1 -component Nmh
-test -append
131 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
132 check
"$expected" "$actual"
133 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
136 printf 'Nmh-test: test of anno -list\n' >"$expected"
137 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
138 run_prog anno
1 -component Nmh
-test -nodate -text 'test of anno -list'
139 run_test
'anno 1 -component Nmh-test -list' 'test of anno -list'
141 check
"$expected" "${MH_TEST_DIR}/Mail/inbox/1"
142 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
144 # check -list -number
145 printf 'Nmh-test: test of anno -list -number\n' >"$expected"
146 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
147 run_prog anno
1 -component Nmh
-test -nodate -text 'test of anno -list -number'
148 run_test
'anno 1 -component Nmh-test -list -number' \
149 '1 test of anno -list -number'
150 check
"$expected" "${MH_TEST_DIR}/Mail/inbox/1"
151 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
154 cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
155 run_prog anno
1 -component Nmh
-test
156 run_prog anno
1 -component Nmh
-test -delete
157 sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual"
158 check
"$expected" "$actual"
159 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
161 # check -delete -number
162 printf 'Nmh-test: 1\nNmh-test: 3\n' >"$expected"
163 cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected"
164 run_prog anno
1 -component Nmh
-test -nodate -text 3
165 run_prog anno
1 -component Nmh
-test -nodate -text 2
166 run_prog anno
1 -component Nmh
-test -nodate -text 1
167 run_prog anno
1 -component Nmh
-test -delete -number 2
168 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
169 check
"$expected" "$actual"
170 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
173 cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected"
174 run_prog anno
1 -component Nmh
-test -nodate -text 3
175 run_prog anno
1 -component Nmh
-test -nodate -text 2
176 run_prog anno
1 -component Nmh
-test -nodate -text 1
177 run_prog anno
1 -component Nmh
-test -delete -number all
178 cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual"
179 check
"$expected" "$actual"
180 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
183 touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/1"
184 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
185 run_prog anno
1 -component Nmh
-test -preserve
186 run_prog anno
1 -component Nmh
-test -preserve -delete
187 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls2"
188 check
"$actual-ls1" "$actual-ls2"
189 cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1"
192 touch -t '2012100100.00' "${MH_TEST_DIR}/Mail/inbox/1"
193 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1"
194 run_prog anno
1 -component Nmh
-test -preserve -nopreserve
195 run_prog anno
1 -component Nmh
-test -preserve -nopreserve -delete
196 ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls2"
198 diff "$actual-ls1" "$actual-ls2" >/dev
/null
199 run_test
'printf 1' "$?"
201 rm "$actual-ls1" "$actual-ls2"