summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-11-29 23:17:21 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-11-30 00:13:17 +0200
commit5ccef4cfd1eb3252430f04fa8418268a93ff8b08 (patch)
treefc823678dbb6131d37475f458361007a7951e277
parentb3bc4bafc0c4a26e7cdabae73564de8f3d6b2b2f (diff)
downloadmailutils-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.in2
-rw-r--r--mail/tests/hold.at32
-rw-r--r--testsuite/cwdrepl.c10
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
5PATH=@abs_builddir@:@abs_top_builddir@/mail:$top_srcdir:$srcdir:$PATH 5PATH=@abs_top_builddir@/testsuite:@abs_builddir@:@abs_top_builddir@/mail:$top_srcdir:$srcdir:$PATH
6testsuitedir=@abs_top_srcdir@/testsuite 6testsuitedir=@abs_top_srcdir@/testsuite
7MALLOC_CHECK_=2 7MALLOC_CHECK_=2
8export MALLOC_CHECK_ 8export MALLOC_CHECK_
9catmbox() { 9catmbox() {
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])
23AT_DATA([rc],[$4]) 23AT_DATA([rc],[$4])
24export MAIL=inbox 24export MAIL=inbox
25export MBOX=mbox 25export MBOX=mbox
26> $MBOX 26> $MBOX
27CWD=$(pwd) 27CWD=$(pwd)
28MUT_MAIL_CMD -N -E "set folder=$CWD" < rc | sed -e 's/ *$//' -e "s|$CWD/||" 28MUT_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])
33AT_CLEANUP]) 33AT_CLEANUP])
34 34
@@ -64,14 +64,14 @@ quit
64], 64],
65[From: March Hare <hare@wonder.land> 65[From: March Hare <hare@wonder.land>
66To: Alice <alice@wonder.land> 66To: Alice <alice@wonder.land>
67Subject: Invitation 67Subject: Invitation
68 68
69Have some wine 69Have some wine
70Saved 1 message in mbox 70Saved 1 message in ./mbox
71Held 1 message in inbox 71Held 1 message in ./inbox
72== inbox == 72== inbox ==
73From alice@wonder.land Mon Jul 29 22:00:09 2002 73From alice@wonder.land Mon Jul 29 22:00:09 2002
74From: Alice <alice@wonder.land> 74From: Alice <alice@wonder.land>
75To: March Hare <hare@wonder.land> 75To: March Hare <hare@wonder.land>
76Subject: Re: Invitation 76Subject: Re: Invitation
77Status: O 77Status: O
@@ -101,13 +101,13 @@ quit
101], 101],
102[From: March Hare <hare@wonder.land> 102[From: March Hare <hare@wonder.land>
103To: Alice <alice@wonder.land> 103To: Alice <alice@wonder.land>
104Subject: Invitation 104Subject: Invitation
105 105
106Have some wine 106Have some wine
107Held 2 messages in inbox 107Held 2 messages in ./inbox
108== inbox == 108== inbox ==
109From hare@wonder.land Mon Jul 29 22:00:08 2002 109From hare@wonder.land Mon Jul 29 22:00:08 2002
110From: March Hare <hare@wonder.land> 110From: March Hare <hare@wonder.land>
111To: Alice <alice@wonder.land> 111To: Alice <alice@wonder.land>
112Subject: Invitation 112Subject: Invitation
113Status: OR 113Status: OR
@@ -133,14 +133,14 @@ echo == mbox ==
133catmbox mbox 133catmbox mbox
134], 134],
135[set nohold 135[set nohold
136touch 1 136touch 1
137quit 137quit
138], 138],
139[Saved 1 message in mbox 139[Saved 1 message in ./mbox
140Held 1 message in inbox 140Held 1 message in ./inbox
141== inbox == 141== inbox ==
142From alice@wonder.land Mon Jul 29 22:00:09 2002 142From alice@wonder.land Mon Jul 29 22:00:09 2002
143From: Alice <alice@wonder.land> 143From: Alice <alice@wonder.land>
144To: March Hare <hare@wonder.land> 144To: March Hare <hare@wonder.land>
145Subject: Re: Invitation 145Subject: Re: Invitation
146Status: O 146Status: O
@@ -165,13 +165,13 @@ echo == mbox ==
165catmbox mbox 165catmbox mbox
166], 166],
167[set hold 167[set hold
168touch 1 168touch 1
169quit 169quit
170], 170],
171[Held 2 messages in inbox 171[Held 2 messages in ./inbox
172== inbox == 172== inbox ==
173From hare@wonder.land Mon Jul 29 22:00:08 2002 173From hare@wonder.land Mon Jul 29 22:00:08 2002
174From: March Hare <hare@wonder.land> 174From: March Hare <hare@wonder.land>
175To: Alice <alice@wonder.land> 175To: Alice <alice@wonder.land>
176Subject: Invitation 176Subject: Invitation
177Status: O 177Status: O
@@ -199,14 +199,14 @@ echo == dest ==
199catmbox dest 199catmbox dest
200], 200],
201[set nohold nokeepsave 201[set nohold nokeepsave
202save 1 +dest 202save 1 +dest
203quit 203quit
204], 204],
205["dest" 7/152 205["./dest" 7/152
206Held 1 message in inbox 206Held 1 message in ./inbox
207== inbox == 207== inbox ==
208From alice@wonder.land Mon Jul 29 22:00:09 2002 208From alice@wonder.land Mon Jul 29 22:00:09 2002
209From: Alice <alice@wonder.land> 209From: Alice <alice@wonder.land>
210To: March Hare <hare@wonder.land> 210To: March Hare <hare@wonder.land>
211Subject: Re: Invitation 211Subject: Re: Invitation
212Status: O 212Status: O
@@ -234,15 +234,15 @@ echo == dest ==
234catmbox dest 234catmbox dest
235], 235],
236[set nohold keepsave 236[set nohold keepsave
237save 1 +dest 237save 1 +dest
238quit 238quit
239], 239],
240["dest" 7/152 240["./dest" 7/152
241Saved 1 message in mbox 241Saved 1 message in ./mbox
242Held 1 message in inbox 242Held 1 message in ./inbox
243== inbox == 243== inbox ==
244From alice@wonder.land Mon Jul 29 22:00:09 2002 244From alice@wonder.land Mon Jul 29 22:00:09 2002
245From: Alice <alice@wonder.land> 245From: Alice <alice@wonder.land>
246To: March Hare <hare@wonder.land> 246To: March Hare <hare@wonder.land>
247Subject: Re: Invitation 247Subject: Re: Invitation
248Status: O 248Status: O
@@ -277,14 +277,14 @@ echo == dest ==
277catmbox dest 277catmbox dest
278], 278],
279[set hold keepsave 279[set hold keepsave
280save 1 +dest 280save 1 +dest
281quit 281quit
282], 282],
283["dest" 7/152 283["./dest" 7/152
284Held 2 messages in inbox 284Held 2 messages in ./inbox
285== inbox == 285== inbox ==
286From hare@wonder.land Mon Jul 29 22:00:08 2002 286From hare@wonder.land Mon Jul 29 22:00:08 2002
287From: March Hare <hare@wonder.land> 287From: March Hare <hare@wonder.land>
288To: Alice <alice@wonder.land> 288To: Alice <alice@wonder.land>
289Subject: Invitation 289Subject: Invitation
290Status: O 290Status: O
@@ -320,14 +320,14 @@ echo == dest ==
320catmbox dest 320catmbox dest
321], 321],
322[set hold nokeepsave 322[set hold nokeepsave
323save 1 +dest 323save 1 +dest
324quit 324quit
325], 325],
326["dest" 7/152 326["./dest" 7/152
327Held 1 message in inbox 327Held 1 message in ./inbox
328== inbox == 328== inbox ==
329From alice@wonder.land Mon Jul 29 22:00:09 2002 329From alice@wonder.land Mon Jul 29 22:00:09 2002
330From: Alice <alice@wonder.land> 330From: Alice <alice@wonder.land>
331To: March Hare <hare@wonder.land> 331To: March Hare <hare@wonder.land>
332Subject: Re: Invitation 332Subject: Re: Invitation
333Status: O 333Status: 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
64static int 64static int
65transcmp (const void *a, const void *b) 65transcmp (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