diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-11-29 23:17:21 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-11-30 00:13:17 +0200 |
commit | 5ccef4cfd1eb3252430f04fa8418268a93ff8b08 (patch) | |
tree | fc823678dbb6131d37475f458361007a7951e277 | |
parent | b3bc4bafc0c4a26e7cdabae73564de8f3d6b2b2f (diff) | |
download | mailutils-5ccef4cfd1eb3252430f04fa8418268a93ff8b08.tar.gz mailutils-5ccef4cfd1eb3252430f04fa8418268a93ff8b08.tar.bz2 |
Fix the cwdrepl auxiliary tool.
Make sure the longest possible match is replaced.
* testsuite/cwdrepl.c: Sort the translist by directory
length, in descending order.
* mail/tests/atlocal.in: Add $testsuitedir to $PATH
* mail/tests/hold.at (MAIL_TEST): Use cwdrepl instead
of sed rules. Correct expected outputs accordingly.
-rw-r--r-- | mail/tests/atlocal.in | 2 | ||||
-rw-r--r-- | mail/tests/hold.at | 32 | ||||
-rw-r--r-- | testsuite/cwdrepl.c | 10 |
3 files changed, 26 insertions, 18 deletions
diff --git a/mail/tests/atlocal.in b/mail/tests/atlocal.in index 80e3ea021..9bed5ac56 100644 --- a/mail/tests/atlocal.in +++ b/mail/tests/atlocal.in | |||
@@ -1,11 +1,11 @@ | |||
1 | # @configure_input@ -*- shell-script -*- | 1 | # @configure_input@ -*- shell-script -*- |
2 | # Configurable variable values for Mailutils test suite. | 2 | # Configurable variable values for Mailutils test suite. |
3 | # Copyright (C) 2004-2019 Free Software Foundation, Inc. | 3 | # Copyright (C) 2004-2019 Free Software Foundation, Inc. |
4 | 4 | ||
5 | PATH=@abs_builddir@:@abs_top_builddir@/mail:$top_srcdir:$srcdir:$PATH | 5 | PATH=@abs_top_builddir@/testsuite:@abs_builddir@:@abs_top_builddir@/mail:$top_srcdir:$srcdir:$PATH |
6 | testsuitedir=@abs_top_srcdir@/testsuite | 6 | testsuitedir=@abs_top_srcdir@/testsuite |
7 | MALLOC_CHECK_=2 | 7 | MALLOC_CHECK_=2 |
8 | export MALLOC_CHECK_ | 8 | export MALLOC_CHECK_ |
9 | catmbox() { | 9 | catmbox() { |
10 | sed -e /^X-IMAPbase:/d -e /^X-UID:/d $1 | 10 | sed -e /^X-IMAPbase:/d -e /^X-UID:/d $1 |
11 | } | 11 | } |
diff --git a/mail/tests/hold.at b/mail/tests/hold.at index 1bf2531e8..dcd9befe3 100644 --- a/mail/tests/hold.at +++ b/mail/tests/hold.at | |||
@@ -22,13 +22,13 @@ AT_CHECK( | |||
22 | [AT_DATA([inbox],[$2]) | 22 | [AT_DATA([inbox],[$2]) |
23 | AT_DATA([rc],[$4]) | 23 | AT_DATA([rc],[$4]) |
24 | export MAIL=inbox | 24 | export MAIL=inbox |
25 | export MBOX=mbox | 25 | export MBOX=mbox |
26 | > $MBOX | 26 | > $MBOX |
27 | CWD=$(pwd) | 27 | CWD=$(pwd) |
28 | MUT_MAIL_CMD -N -E "set folder=$CWD" < rc | sed -e 's/ *$//' -e "s|$CWD/||" | 28 | MUT_MAIL_CMD -N -E "set folder=$CWD" < rc | cwdrepl | sed -e 's/ *$//' |
29 | $3 | 29 | $3 |
30 | ], | 30 | ], |
31 | [0], | 31 | [0], |
32 | [$5]) | 32 | [$5]) |
33 | AT_CLEANUP]) | 33 | AT_CLEANUP]) |
34 | 34 | ||
@@ -64,14 +64,14 @@ quit | |||
64 | ], | 64 | ], |
65 | [From: March Hare <hare@wonder.land> | 65 | [From: March Hare <hare@wonder.land> |
66 | To: Alice <alice@wonder.land> | 66 | To: Alice <alice@wonder.land> |
67 | Subject: Invitation | 67 | Subject: Invitation |
68 | 68 | ||
69 | Have some wine | 69 | Have some wine |
70 | Saved 1 message in mbox | 70 | Saved 1 message in ./mbox |
71 | Held 1 message in inbox | 71 | Held 1 message in ./inbox |
72 | == inbox == | 72 | == inbox == |
73 | From alice@wonder.land Mon Jul 29 22:00:09 2002 | 73 | From alice@wonder.land Mon Jul 29 22:00:09 2002 |
74 | From: Alice <alice@wonder.land> | 74 | From: Alice <alice@wonder.land> |
75 | To: March Hare <hare@wonder.land> | 75 | To: March Hare <hare@wonder.land> |
76 | Subject: Re: Invitation | 76 | Subject: Re: Invitation |
77 | Status: O | 77 | Status: O |
@@ -101,13 +101,13 @@ quit | |||
101 | ], | 101 | ], |
102 | [From: March Hare <hare@wonder.land> | 102 | [From: March Hare <hare@wonder.land> |
103 | To: Alice <alice@wonder.land> | 103 | To: Alice <alice@wonder.land> |
104 | Subject: Invitation | 104 | Subject: Invitation |
105 | 105 | ||
106 | Have some wine | 106 | Have some wine |
107 | Held 2 messages in inbox | 107 | Held 2 messages in ./inbox |
108 | == inbox == | 108 | == inbox == |
109 | From hare@wonder.land Mon Jul 29 22:00:08 2002 | 109 | From hare@wonder.land Mon Jul 29 22:00:08 2002 |
110 | From: March Hare <hare@wonder.land> | 110 | From: March Hare <hare@wonder.land> |
111 | To: Alice <alice@wonder.land> | 111 | To: Alice <alice@wonder.land> |
112 | Subject: Invitation | 112 | Subject: Invitation |
113 | Status: OR | 113 | Status: OR |
@@ -133,14 +133,14 @@ echo == mbox == | |||
133 | catmbox mbox | 133 | catmbox mbox |
134 | ], | 134 | ], |
135 | [set nohold | 135 | [set nohold |
136 | touch 1 | 136 | touch 1 |
137 | quit | 137 | quit |
138 | ], | 138 | ], |
139 | [Saved 1 message in mbox | 139 | [Saved 1 message in ./mbox |
140 | Held 1 message in inbox | 140 | Held 1 message in ./inbox |
141 | == inbox == | 141 | == inbox == |
142 | From alice@wonder.land Mon Jul 29 22:00:09 2002 | 142 | From alice@wonder.land Mon Jul 29 22:00:09 2002 |
143 | From: Alice <alice@wonder.land> | 143 | From: Alice <alice@wonder.land> |
144 | To: March Hare <hare@wonder.land> | 144 | To: March Hare <hare@wonder.land> |
145 | Subject: Re: Invitation | 145 | Subject: Re: Invitation |
146 | Status: O | 146 | Status: O |
@@ -165,13 +165,13 @@ echo == mbox == | |||
165 | catmbox mbox | 165 | catmbox mbox |
166 | ], | 166 | ], |
167 | [set hold | 167 | [set hold |
168 | touch 1 | 168 | touch 1 |
169 | quit | 169 | quit |
170 | ], | 170 | ], |
171 | [Held 2 messages in inbox | 171 | [Held 2 messages in ./inbox |
172 | == inbox == | 172 | == inbox == |
173 | From hare@wonder.land Mon Jul 29 22:00:08 2002 | 173 | From hare@wonder.land Mon Jul 29 22:00:08 2002 |
174 | From: March Hare <hare@wonder.land> | 174 | From: March Hare <hare@wonder.land> |
175 | To: Alice <alice@wonder.land> | 175 | To: Alice <alice@wonder.land> |
176 | Subject: Invitation | 176 | Subject: Invitation |
177 | Status: O | 177 | Status: O |
@@ -199,14 +199,14 @@ echo == dest == | |||
199 | catmbox dest | 199 | catmbox dest |
200 | ], | 200 | ], |
201 | [set nohold nokeepsave | 201 | [set nohold nokeepsave |
202 | save 1 +dest | 202 | save 1 +dest |
203 | quit | 203 | quit |
204 | ], | 204 | ], |
205 | ["dest" 7/152 | 205 | ["./dest" 7/152 |
206 | Held 1 message in inbox | 206 | Held 1 message in ./inbox |
207 | == inbox == | 207 | == inbox == |
208 | From alice@wonder.land Mon Jul 29 22:00:09 2002 | 208 | From alice@wonder.land Mon Jul 29 22:00:09 2002 |
209 | From: Alice <alice@wonder.land> | 209 | From: Alice <alice@wonder.land> |
210 | To: March Hare <hare@wonder.land> | 210 | To: March Hare <hare@wonder.land> |
211 | Subject: Re: Invitation | 211 | Subject: Re: Invitation |
212 | Status: O | 212 | Status: O |
@@ -234,15 +234,15 @@ echo == dest == | |||
234 | catmbox dest | 234 | catmbox dest |
235 | ], | 235 | ], |
236 | [set nohold keepsave | 236 | [set nohold keepsave |
237 | save 1 +dest | 237 | save 1 +dest |
238 | quit | 238 | quit |
239 | ], | 239 | ], |
240 | ["dest" 7/152 | 240 | ["./dest" 7/152 |
241 | Saved 1 message in mbox | 241 | Saved 1 message in ./mbox |
242 | Held 1 message in inbox | 242 | Held 1 message in ./inbox |
243 | == inbox == | 243 | == inbox == |
244 | From alice@wonder.land Mon Jul 29 22:00:09 2002 | 244 | From alice@wonder.land Mon Jul 29 22:00:09 2002 |
245 | From: Alice <alice@wonder.land> | 245 | From: Alice <alice@wonder.land> |
246 | To: March Hare <hare@wonder.land> | 246 | To: March Hare <hare@wonder.land> |
247 | Subject: Re: Invitation | 247 | Subject: Re: Invitation |
248 | Status: O | 248 | Status: O |
@@ -277,14 +277,14 @@ echo == dest == | |||
277 | catmbox dest | 277 | catmbox dest |
278 | ], | 278 | ], |
279 | [set hold keepsave | 279 | [set hold keepsave |
280 | save 1 +dest | 280 | save 1 +dest |
281 | quit | 281 | quit |
282 | ], | 282 | ], |
283 | ["dest" 7/152 | 283 | ["./dest" 7/152 |
284 | Held 2 messages in inbox | 284 | Held 2 messages in ./inbox |
285 | == inbox == | 285 | == inbox == |
286 | From hare@wonder.land Mon Jul 29 22:00:08 2002 | 286 | From hare@wonder.land Mon Jul 29 22:00:08 2002 |
287 | From: March Hare <hare@wonder.land> | 287 | From: March Hare <hare@wonder.land> |
288 | To: Alice <alice@wonder.land> | 288 | To: Alice <alice@wonder.land> |
289 | Subject: Invitation | 289 | Subject: Invitation |
290 | Status: O | 290 | Status: O |
@@ -320,14 +320,14 @@ echo == dest == | |||
320 | catmbox dest | 320 | catmbox dest |
321 | ], | 321 | ], |
322 | [set hold nokeepsave | 322 | [set hold nokeepsave |
323 | save 1 +dest | 323 | save 1 +dest |
324 | quit | 324 | quit |
325 | ], | 325 | ], |
326 | ["dest" 7/152 | 326 | ["./dest" 7/152 |
327 | Held 1 message in inbox | 327 | Held 1 message in ./inbox |
328 | == inbox == | 328 | == inbox == |
329 | From alice@wonder.land Mon Jul 29 22:00:09 2002 | 329 | From alice@wonder.land Mon Jul 29 22:00:09 2002 |
330 | From: Alice <alice@wonder.land> | 330 | From: Alice <alice@wonder.land> |
331 | To: March Hare <hare@wonder.land> | 331 | To: March Hare <hare@wonder.land> |
332 | Subject: Re: Invitation | 332 | Subject: Re: Invitation |
333 | Status: O | 333 | Status: O |
diff --git a/testsuite/cwdrepl.c b/testsuite/cwdrepl.c index 44fcfd768..31de06bef 100644 --- a/testsuite/cwdrepl.c +++ b/testsuite/cwdrepl.c | |||
@@ -63,13 +63,19 @@ mu_list_t translist; | |||
63 | 63 | ||
64 | static int | 64 | static int |
65 | transcmp (const void *a, const void *b) | 65 | transcmp (const void *a, const void *b) |
66 | { | 66 | { |
67 | struct dirtrans const *trans1 = a; | 67 | struct dirtrans const *trans1 = a; |
68 | struct dirtrans const *trans2 = b; | 68 | struct dirtrans const *trans2 = b; |
69 | return strcmp (trans1->dir, trans2->dir); | 69 | size_t l1 = strlen (trans1->dir); |
70 | size_t l2 = strlen (trans2->dir); | ||
71 | if (l1 < l2) | ||
72 | return 1; | ||
73 | else if (l1 > l2) | ||
74 | return -1; | ||
75 | return strcmp (trans2->dir, trans1->dir); | ||
70 | } | 76 | } |
71 |