summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-03-06 13:58:16 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-03-06 13:58:16 +0200
commit57d9a048fecafa6ba73810c14802720b2873264d (patch)
treedd5532964c9d29bc8d55cfa61a27d8c083288a71
parent6b9a8773acd930884d8a92617011683cb2c87341 (diff)
downloadmailutils-57d9a048fecafa6ba73810c14802720b2873264d.tar.gz
mailutils-57d9a048fecafa6ba73810c14802720b2873264d.tar.bz2
Simplify dotmail test environment
The dm_mbox tool is not needed after ff847bb1. Remove it. Modify dm_mesg to optionally take commands from the command line. Use it instead of dm_mbox in testcases.
-rw-r--r--libproto/dotmail/tests/.gitignore1
-rw-r--r--libproto/dotmail/tests/Makefile.am1
-rw-r--r--libproto/dotmail/tests/append.at12
-rw-r--r--libproto/dotmail/tests/count.at4
-rw-r--r--libproto/dotmail/tests/delete.at4
-rw-r--r--libproto/dotmail/tests/dm_mbox.c124
-rw-r--r--libproto/dotmail/tests/dm_mesg.c242
-rw-r--r--libproto/dotmail/tests/recent.at4
-rw-r--r--libproto/dotmail/tests/uidvalidity.at6
-rw-r--r--libproto/dotmail/tests/unseen.at4
10 files changed, 157 insertions, 245 deletions
diff --git a/libproto/dotmail/tests/.gitignore b/libproto/dotmail/tests/.gitignore
index 3049d1569..015d6e9e8 100644
--- a/libproto/dotmail/tests/.gitignore
+++ b/libproto/dotmail/tests/.gitignore
@@ -1,7 +1,6 @@
1/atconfig 1/atconfig
2/atlocal 2/atlocal
3/dm_detect 3/dm_detect
4/dm_mbox
5/dm_mesg 4/dm_mesg
6/dm_qget 5/dm_qget
7/package.m4 6/package.m4
diff --git a/libproto/dotmail/tests/Makefile.am b/libproto/dotmail/tests/Makefile.am
index 8139e51b4..46330db53 100644
--- a/libproto/dotmail/tests/Makefile.am
+++ b/libproto/dotmail/tests/Makefile.am
@@ -40,7 +40,6 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
40 40
41AM_CPPFLAGS = @MU_LIB_COMMON_INCLUDES@ 41AM_CPPFLAGS = @MU_LIB_COMMON_INCLUDES@
42noinst_PROGRAMS = \ 42noinst_PROGRAMS = \
43 dm_mbox\
44 dm_mesg\ 43 dm_mesg\
45 dm_qget\ 44 dm_qget\
46 dm_detect 45 dm_detect
diff --git a/libproto/dotmail/tests/append.at b/libproto/dotmail/tests/append.at
index e8950db73..91d9d5635 100644
--- a/libproto/dotmail/tests/append.at
+++ b/libproto/dotmail/tests/append.at
@@ -66,7 +66,7 @@ X-UID: 1034
66 66
67Then it wasn't very civil of you to offer it 67Then it wasn't very civil of you to offer it
68])], 68])],
69[dm_mbox count], 69[dm_mesg count],
70[# Append new message 70[# Append new message
71append msg 71append msg
72# Select it 72# Select it
@@ -92,7 +92,7 @@ Return-Path:alice@wonder.land
92 92
934 body_text: Then it wasn't very civil of you to offer it 934 body_text: Then it wasn't very civil of you to offer it
94 94
954 95count: 4
96]) 96])
97 97
98DM_MESG([append with uid], 98DM_MESG([append with uid],
@@ -151,7 +151,7 @@ X-UID: 1034
151 151
152Then it wasn't very civil of you to offer it 152Then it wasn't very civil of you to offer it
153])], 153])],
154[dm_mbox count uidvalidity uidnext], 154[dm_mesg count\; uidvalidity\; uidnext],
155[# Append new message 155[# Append new message
156append msg 156append msg
157# Select it 157# Select it
@@ -185,9 +185,9 @@ X-UID:140
185uidvalidity: 1027976406 185uidvalidity: 1027976406
186uidnext: 141 186uidnext: 141
187sync: OK 187sync: OK
1884 188count: 4
1891027976406 189uidvalidity: 1027976406
190141 190uidnext: 141
191]) 191])
192 192
193DM_MESG([append to empty mailbox], 193DM_MESG([append to empty mailbox],
diff --git a/libproto/dotmail/tests/count.at b/libproto/dotmail/tests/count.at
index d86f429a9..d367e790e 100644
--- a/libproto/dotmail/tests/count.at
+++ b/libproto/dotmail/tests/count.at
@@ -15,7 +15,7 @@
15# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. 15# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
16 16
17DM_TEST([count], 17DM_TEST([count],
18[dm_mbox count], 18[dm_mesg count],
19[Received: (from hare@wonder.land) 19[Received: (from hare@wonder.land)
20 by wonder.land id 3301 20 by wonder.land id 3301
21 for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100 21 for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -54,5 +54,5 @@ Return-Path: hare@wonder.land
54There isn't any 54There isn't any
55. 55.
56], 56],
57[3 57[count: 3
58]) 58])
diff --git a/libproto/dotmail/tests/delete.at b/libproto/dotmail/tests/delete.at
index 212be15c5..84bdadb1b 100644
--- a/libproto/dotmail/tests/delete.at
+++ b/libproto/dotmail/tests/delete.at
@@ -64,7 +64,7 @@ Return-Path: alice@wonder.land
64Then it wasn't very civil of you to offer it 64Then it wasn't very civil of you to offer it
65. 65.
66], 66],
67[],[dm_mbox count], 67[],[dm_mesg count],
68[# Mark third message as deleted 68[# Mark third message as deleted
693 693
70set_deleted 70set_deleted
@@ -90,5 +90,5 @@ Return-Path:alice@wonder.land
90 90
913 body_text: Then it wasn't very civil of you to offer it 913 body_text: Then it wasn't very civil of you to offer it
92 92
933 93count: 3
94]) 94])
diff --git a/libproto/dotmail/tests/dm_mbox.c b/libproto/dotmail/tests/dm_mbox.c
deleted file mode 100644
index f0c67e005..000000000
--- a/libproto/dotmail/tests/dm_mbox.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2019 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
16
17#include <mailutils/mailutils.h>
18
19void
20dm_count (mu_mailbox_t mbx)
21{
22 size_t n;
23 MU_ASSERT (mu_mailbox_messages_count (mbx, &n));
24 mu_printf ("%lu\n", (unsigned long) n);
25}
26
27void
28dm_uidvalidity (mu_mailbox_t mbx)
29{
30 unsigned long v;
31 MU_ASSERT (mu_mailbox_uidvalidity (mbx, &v));
32 mu_printf ("%lu\n", v);
33}
34
35void
36dm_uidnext (mu_mailbox_t mbx)
37{
38 size_t n;
39 MU_ASSERT (mu_mailbox_uidnext (mbx, &n));
40 mu_printf ("%lu\n", (unsigned long) n);
41}
42
43void
44dm_recent (mu_mailbox_t mbx)
45{
46 size_t n;
47 MU_ASSERT (mu_mailbox_messages_recent (mbx, &n));
48 mu_printf ("%lu\n", (unsigned long) n);
49}
50
51void
52dm_unseen (mu_mailbox_t mbx)
53{
54 size_t n;
55 MU_ASSERT (mu_mailbox_message_unseen (mbx, &n));
56 mu_printf ("%lu\n", (unsigned long) n);
57}
58
59typedef void (*dm_action) (mu_mailbox_t);
60
61static struct
62{
63 char *name;
64 dm_action act;
65} actions[] = {
66 { "count", dm_count },
67 { "uidnext", dm_uidnext },
68 { "uidvalidity", dm_uidvalidity },
69 { "recent", dm_recent },
70 { "unseen", dm_unseen },
71 { NULL }
72};
73
74static dm_action
75get_action (char const *s)
76{
77 size_t i;
78
79 for (i = 0; actions[i].name; i++)
80 if (strcmp (actions[i].name, s) == 0)
81 return actions[i].act;
82
83 return NULL;
84}
85
86int
87main (int argc, char **argv)
88{
89 mu_mailbox_t mbx;
90
91 mu_set_program_name (argv[0]);
92 mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
93 mu_registrar_record (mu_dotmail_record);
94
95 argc--;