diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-03-06 13:58:16 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-03-06 13:58:16 +0200 |
commit | 57d9a048fecafa6ba73810c14802720b2873264d (patch) | |
tree | dd5532964c9d29bc8d55cfa61a27d8c083288a71 | |
parent | 6b9a8773acd930884d8a92617011683cb2c87341 (diff) | |
download | mailutils-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/.gitignore | 1 | ||||
-rw-r--r-- | libproto/dotmail/tests/Makefile.am | 1 | ||||
-rw-r--r-- | libproto/dotmail/tests/append.at | 12 | ||||
-rw-r--r-- | libproto/dotmail/tests/count.at | 4 | ||||
-rw-r--r-- | libproto/dotmail/tests/delete.at | 4 | ||||
-rw-r--r-- | libproto/dotmail/tests/dm_mbox.c | 124 | ||||
-rw-r--r-- | libproto/dotmail/tests/dm_mesg.c | 242 | ||||
-rw-r--r-- | libproto/dotmail/tests/recent.at | 4 | ||||
-rw-r--r-- | libproto/dotmail/tests/uidvalidity.at | 6 | ||||
-rw-r--r-- | libproto/dotmail/tests/unseen.at | 4 |
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 | ||
41 | AM_CPPFLAGS = @MU_LIB_COMMON_INCLUDES@ | 41 | AM_CPPFLAGS = @MU_LIB_COMMON_INCLUDES@ |
42 | noinst_PROGRAMS = \ | 42 | noinst_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 | ||
67 | Then it wasn't very civil of you to offer it | 67 | Then 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 |
71 | append msg | 71 | append msg |
72 | # Select it | 72 | # Select it |
@@ -92,7 +92,7 @@ Return-Path:alice@wonder.land | |||
92 | 92 | ||
93 | 4 body_text: Then it wasn't very civil of you to offer it | 93 | 4 body_text: Then it wasn't very civil of you to offer it |
94 | 94 | ||
95 | 4 | 95 | count: 4 |
96 | ]) | 96 | ]) |
97 | 97 | ||
98 | DM_MESG([append with uid], | 98 | DM_MESG([append with uid], |
@@ -151,7 +151,7 @@ X-UID: 1034 | |||
151 | 151 | ||
152 | Then it wasn't very civil of you to offer it | 152 | Then 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 |
156 | append msg | 156 | append msg |
157 | # Select it | 157 | # Select it |
@@ -185,9 +185,9 @@ X-UID:140 | |||
185 | uidvalidity: 1027976406 | 185 | uidvalidity: 1027976406 |
186 | uidnext: 141 | 186 | uidnext: 141 |
187 | sync: OK | 187 | sync: OK |
188 | 4 | 188 | count: 4 |
189 | 1027976406 | 189 | uidvalidity: 1027976406 |
190 | 141 | 190 | uidnext: 141 |
191 | ]) | 191 | ]) |
192 | 192 | ||
193 | DM_MESG([append to empty mailbox], | 193 | DM_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 | ||
17 | DM_TEST([count], | 17 | DM_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 | |||
54 | There isn't any | 54 | There 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 | |||
64 | Then it wasn't very civil of you to offer it | 64 | Then 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 |
69 | 3 | 69 | 3 |
70 | set_deleted | 70 | set_deleted |
@@ -90,5 +90,5 @@ Return-Path:alice@wonder.land | |||
90 | 90 | ||
91 | 3 body_text: Then it wasn't very civil of you to offer it | 91 | 3 body_text: Then it wasn't very civil of you to offer it |
92 | 92 | ||
93 | 3 | 93 | count: 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 | |||
19 | void | ||
20 | dm_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 | |||
27 | void | ||
28 | dm_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 | |||
35 | void | ||
36 | dm_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 | |||
43 | void | ||
44 | dm_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 | |||
51 | void | ||
52 | dm_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 | |||
59 | typedef void (*dm_action) (mu_mailbox_t); | ||
60 | |||
61 | static 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 | |||
74 | static dm_action | ||
75 | get_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 | |||
86 | int | ||
87 | main (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--; |