summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-03-02 13:40:18 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-03-02 14:08:43 (GMT)
commit4d422ec9bf22cb45785ed7a17a60d0d7b2bb013b (patch) (side-by-side diff)
tree8121a557819cc66c07d3d03c7118547e1cd005ed
parent1ed195f6b39a8ded621ebb00b04b0418b8cc4e8f (diff)
downloadmailutils-4d422ec9bf22cb45785ed7a17a60d0d7b2bb013b.tar.gz
mailutils-4d422ec9bf22cb45785ed7a17a60d0d7b2bb013b.tar.bz2
Improve the dotmail testsuite
* libproto/dotmail/tests/dm_mesg.c: Rewrite to take commands from stdin. * libproto/dotmail/tests/Makefile.am: Add setattr.at * libproto/dotmail/tests/testsuite.at (DM_MESG): New macro. * libproto/dotmail/tests/setattr.at: New file. * libproto/dotmail/tests/append.at: Use DM_MESG. * libproto/dotmail/tests/attr.at: Likewise. * libproto/dotmail/tests/body.at: Likewise. * libproto/dotmail/tests/delete.at: Likewise. * libproto/dotmail/tests/env.at: Likewise. * libproto/dotmail/tests/header.at: Likewise. * libproto/dotmail/tests/uid.at: Likewise.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libproto/dotmail/tests/Makefile.am3
-rw-r--r--libproto/dotmail/tests/append.at43
-rw-r--r--libproto/dotmail/tests/attr.at13
-rw-r--r--libproto/dotmail/tests/body.at15
-rw-r--r--libproto/dotmail/tests/delete.at29
-rw-r--r--libproto/dotmail/tests/dm_mesg.c216
-rw-r--r--libproto/dotmail/tests/env.at11
-rw-r--r--libproto/dotmail/tests/header.at30
-rw-r--r--libproto/dotmail/tests/setattr.at138
-rw-r--r--libproto/dotmail/tests/testsuite.at17
-rw-r--r--libproto/dotmail/tests/uid.at16
11 files changed, 387 insertions, 144 deletions
diff --git a/libproto/dotmail/tests/Makefile.am b/libproto/dotmail/tests/Makefile.am
index a033346..8139e51 100644
--- a/libproto/dotmail/tests/Makefile.am
+++ b/libproto/dotmail/tests/Makefile.am
@@ -65,7 +65,8 @@ TESTSUITE_AT = \
uid.at\
qget.at\
append.at\
- delete.at
+ delete.at\
+ setattr.at
TESTSUITE = $(srcdir)/testsuite
M4=m4
diff --git a/libproto/dotmail/tests/append.at b/libproto/dotmail/tests/append.at
index 1416430..a474edf 100644
--- a/libproto/dotmail/tests/append.at
+++ b/libproto/dotmail/tests/append.at
@@ -14,23 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-DM_TEST([append],
-[AT_DATA([msg],
-[Received: (from alice@wonder.land)
- by wonder.land id 3304
- for hare@wonder.land; Mon, 29 Jul 2002 22:00:09 +0100
-Date: Mon, 29 Jul 2002 22:00:04 +0100
-From: Alice <alice@wonder.land>
-Message-Id: <200207292200.3304@wonder.land>
-To: March Hare <hare@wonder.land>
-Subject: Re: Invitation
-Return-Path: alice@wonder.land
-
-Then it wasn't very civil of you to offer it
-])
-dm_mesg append msg 4 env_date env_sender body_text
-dm_mbox count
-],
+DM_MESG([append],
[Received: (from hare@wonder.land)
by wonder.land id 3301
for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -68,7 +52,32 @@ Return-Path: hare@wonder.land
There isn't any
.
],
+[AT_DATA([msg],
+[Received: (from alice@wonder.land)
+ by wonder.land id 3304
+ for hare@wonder.land; Mon, 29 Jul 2002 22:00:09 +0100
+Date: Mon, 29 Jul 2002 22:00:04 +0100
+From: Alice <alice@wonder.land>
+Message-Id: <200207292200.3304@wonder.land>
+To: March Hare <hare@wonder.land>
+Subject: Re: Invitation
+Return-Path: alice@wonder.land
+
+Then it wasn't very civil of you to offer it
+])],
+[dm_mbox count],
+[# Append new message
+append msg
+# Select it
+4
+# Check if it is scanned and loaded
+env_date
+env_sender
+body_text
+],
+
[append: OK
+4 current message
4 env_date: Mon Jul 29 21:00:09 2002
4 env_sender: alice@wonder.land
4 body_text: Then it wasn't very civil of you to offer it
diff --git a/libproto/dotmail/tests/attr.at b/libproto/dotmail/tests/attr.at
index 0439dcb..11694e5 100644
--- a/libproto/dotmail/tests/attr.at
+++ b/libproto/dotmail/tests/attr.at
@@ -14,8 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-DM_TEST([attr],
-[dm_mesg 1 attr 2 attr],
+DM_MESG([attr],
[Received: (from hare@wonder.land)
by wonder.land id 3301
for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -42,6 +41,14 @@ Return-Path: alice@wonder.land
I don't see any wine
.
],
-[1 attr: -
+[],[],
+[1
+attr
+2
+attr
+],
+[1 current message
+1 attr: -
+2 current message
2 attr: FOR
])
diff --git a/libproto/dotmail/tests/body.at b/libproto/dotmail/tests/body.at
index f0c3836..cb16cac 100644
--- a/libproto/dotmail/tests/body.at
+++ b/libproto/dotmail/tests/body.at
@@ -14,8 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-DM_TEST([body],
-[dm_mesg 1 body_lines body_size 2 body_lines body_size],
+DM_MESG([body],
[Received: (from alice@wonder.land)
by wonder.land id 3314
for hare@wonder.land; Mon, 29 Jul 2002 22:00:19 +0100
@@ -44,8 +43,18 @@ as well say that "I see what I eat" is the same thing as "I eat
what I see"!
.
],
-[1 body_lines: 2
+[],[],
+[1
+body_lines
+body_size
+2
+body_lines
+body_size
+],
+[1 current message
+1 body_lines: 2
1 body_size: 77
+2 current message
2 body_lines: 3
2 body_size: 118
])
diff --git a/libproto/dotmail/tests/delete.at b/libproto/dotmail/tests/delete.at
index b97d3f0..212be15 100644
--- a/libproto/dotmail/tests/delete.at
+++ b/libproto/dotmail/tests/delete.at
@@ -14,10 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-DM_TEST([delete],
-[dm_mesg 3 set_deleted expunge 3 body_text
-dm_mbox count
-],
+DM_MESG([delete],
[Received: (from hare@wonder.land)
by wonder.land id 3301
for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -67,8 +64,30 @@ Return-Path: alice@wonder.land
Then it wasn't very civil of you to offer it
.
],
-[3 set_deleted: OK
+[],[dm_mbox count],
+[# Mark third message as deleted
+3
+set_deleted
+# Expunge deleted messages
+expunge
+# Message 4 becomes 3 after expunge. Re-select it.
+3
+# Display headers and body to check if it has been properly updated.
+headers
+body_text
+],
+[3 current message
+3 set_deleted: OK
expunge: OK
+3 current message
+3 headers: Received:(from alice@wonder.land) by wonder.land id 3304 for hare@wonder.land; Mon, 29 Jul 2002 22:00:09 +0100
+Date:Mon, 29 Jul 2002 22:00:04 +0100
+From:Alice <alice@wonder.land>
+Message-Id:<200207292200.3304@wonder.land>
+To:March Hare <hare@wonder.land>
+Subject:Re: Invitation
+Return-Path:alice@wonder.land
+
3 body_text: Then it wasn't very civil of you to offer it
3
diff --git a/libproto/dotmail/tests/dm_mesg.c b/libproto/dotmail/tests/dm_mesg.c
index 6dbda92..bc868a3 100644
--- a/libproto/dotmail/tests/dm_mesg.c
+++ b/libproto/dotmail/tests/dm_mesg.c
@@ -32,7 +32,7 @@ get_num (char const *s)
}
void
-dm_env_date (mu_message_t msg, char **argv)
+dm_env_date (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_envelope_t env;
char *str;
@@ -44,7 +44,7 @@ dm_env_date (mu_message_t msg, char **argv)
}
void
-dm_env_sender (mu_message_t msg, char **argv)
+dm_env_sender (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_envelope_t env;
char *str;
@@ -56,7 +56,7 @@ dm_env_sender (mu_message_t msg, char **argv)
}
void
-dm_header_lines (mu_message_t msg, char **argv)
+dm_header_lines (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_header_t hdr;
size_t lines;
@@ -66,7 +66,7 @@ dm_header_lines (mu_message_t msg, char **argv)
}
void
-dm_header_count (mu_message_t msg, char **argv)
+dm_header_count (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_header_t hdr;
size_t n;
@@ -76,7 +76,7 @@ dm_header_count (mu_message_t msg, char **argv)
}
void
-dm_header_size (mu_message_t msg, char **argv)
+dm_header_size (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_header_t hdr;
size_t s;
@@ -86,7 +86,7 @@ dm_header_size (mu_message_t msg, char **argv)
}
void
-dm_header_field (mu_message_t msg, char **argv)
+dm_header_field (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_header_t hdr;
size_t n = get_num (argv[0]);
@@ -97,7 +97,7 @@ dm_header_field (mu_message_t msg, char **argv)
}
void
-dm_header_value (mu_message_t msg, char **argv)
+dm_header_value (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_header_t hdr;
size_t n = get_num (argv[0]);
@@ -108,7 +108,7 @@ dm_header_value (mu_message_t msg, char **argv)
}
void
-dm_headers (mu_message_t msg, char **argv)
+dm_headers (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_header_t hdr;
char const *name;
@@ -127,7 +127,7 @@ dm_headers (mu_message_t msg, char **argv)
}
void
-dm_body_lines (mu_message_t msg, char **argv)
+dm_body_lines (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_body_t body;
size_t lines;
@@ -137,7 +137,7 @@ dm_body_lines (mu_message_t msg, char **argv)
}
void
-dm_body_size (mu_message_t msg, char **argv)
+dm_body_size (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_body_t body;
size_t s;
@@ -147,7 +147,7 @@ dm_body_size (mu_message_t msg, char **argv)
}
void
-dm_body_text (mu_message_t msg, char **argv)
+dm_body_text (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_body_t body;
mu_stream_t str;
@@ -158,7 +158,7 @@ dm_body_text (mu_message_t msg, char **argv)
}
void
-dm_attr (mu_message_t msg, char **argv)
+dm_attr (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_attribute_t attr;
char abuf[MU_STATUS_BUF_SIZE];
@@ -168,7 +168,7 @@ dm_attr (mu_message_t msg, char **argv)
}
void
-dm_uid (mu_message_t msg, char **argv)
+dm_uid (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
size_t uid;
MU_ASSERT (mu_message_get_uid (msg, &uid));
@@ -180,7 +180,7 @@ dm_uid (mu_message_t msg, char **argv)
#define __cat4__(a,b,c,d) a ## b ## c ## d
#define ATTR_FUN(op,attr) \
static void \
-__cat4__(dm_,op,_,attr) (mu_message_t msg, char **argv) \
+__cat4__(dm_,op,_,attr) (mu_mailbox_t mbx, mu_message_t msg, char **argv) \
{ \
mu_attribute_t a; \
MU_ASSERT (mu_message_get_attribute (msg, &a)); \
@@ -205,67 +205,84 @@ ATTR_FUN(unset,recent)
ATTR_FUN(unset,read)
void
-dmbox_append (mu_mailbox_t mbx, char *filename)
+dm_append (mu_mailbox_t mbx, mu_message_t msg, char **argv)
{
mu_stream_t str;
- mu_message_t msg;
- MU_ASSERT (mu_file_stream_create (&str, filename, MU_STREAM_READ));
- MU_ASSERT (mu_stream_to_message (str, &msg));
- MU_ASSERT (mu_mailbox_append_message (mbx, msg));
+ mu_message_t newmsg;
+ MU_ASSERT (mu_file_stream_create (&str, argv[0], MU_STREAM_READ));
+ MU_ASSERT (mu_stream_to_message (str, &newmsg));
+ MU_ASSERT (mu_mailbox_append_message (mbx, newmsg));
mu_stream_destroy (&str);
- mu_printf ("append: OK\n");
+ mu_printf ("OK");
}
+void
+dm_expunge (mu_mailbox_t mbx, mu_message_t msg, char **argv)
+{
+ MU_ASSERT (mu_mailbox_expunge (mbx));
+ mu_printf ("OK");
+}
+
+void
+dm_sync (mu_mailbox_t mbx, mu_message_t msg, char **argv)
+{
+ MU_ASSERT (mu_mailbox_sync (mbx));
+ mu_printf ("OK");
+}
-typedef void (*dm_action) (mu_message_t, char **);
+typedef void (*dm_action_fn) (mu_mailbox_t, mu_message_t, char **);
-static struct
+struct dm_action
{
char *name;
- dm_action act;
+ dm_action_fn fn;
+ int needs_message;
int narg;
-} actions[] = {
- { "env_date", dm_env_date },
- { "env_sender", dm_env_sender },
- { "header_lines", dm_header_lines },
- { "header_size", dm_header_size },
- { "header_count", dm_header_count },
- { "header_field", dm_header_field, 1 },
- { "header_value", dm_header_value, 1 },
- { "headers", dm_headers },
- { "body_lines", dm_body_lines },
- { "body_size", dm_body_size },
- { "body_text", dm_body_text },
- { "attr", dm_attr },
- { "uid", dm_uid },
- { "set_seen", dm_set_seen },
- { "set_answered", dm_set_answered },
- { "set_flagged", dm_set_flagged },
- { "set_deleted", dm_set_deleted },
- { "set_draft", dm_set_draft },
- { "set_recent", dm_set_recent },
- { "set_read", dm_set_read },
- { "unset_seen", dm_unset_seen },
- { "unset_answered", dm_unset_answered },
- { "unset_flagged", dm_unset_flagged },
- { "unset_deleted", dm_unset_deleted },
- { "unset_draft", dm_unset_draft },
- { "unset_recent", dm_unset_recent },
- { "unset_read", dm_unset_read },
+};
+
+struct dm_action actions[] = {
+ { "env_date", dm_env_date, 1, 0 },
+ { "env_sender", dm_env_sender, 1, 0 },
+ { "header_lines", dm_header_lines, 1, 0 },
+ { "header_size", dm_header_size, 1, 0 },
+ { "header_count", dm_header_count, 1, 0 },
+ { "header_field", dm_header_field, 1, 1 },
+ { "header_value", dm_header_value, 1, 1 },
+ { "headers", dm_headers, 1, 0 },
+ { "body_lines", dm_body_lines, 1, 0 },
+ { "body_size", dm_body_size, 1, 0 },
+ { "body_text", dm_body_text, 1, 0 },
+ { "attr", dm_attr, 1, 0 },
+ { "uid", dm_uid, 1, 0 },
+ { "set_seen", dm_set_seen, 1, 0 },
+ { "set_answered", dm_set_answered, 1, 0 },
+ { "set_flagged", dm_set_flagged, 1, 0 },
+ { "set_deleted", dm_set_deleted, 1, 0 },
+ { "set_draft", dm_set_draft, 1, 0 },
+ { "set_recent", dm_set_recent, 1, 0 },
+ { "set_read", dm_set_read, 1, 0 },
+ { "unset_seen", dm_unset_seen, 1, 0 },
+ { "unset_answered", dm_unset_answered, 1, 0 },
+ { "unset_flagged", dm_unset_flagged, 1, 0 },
+ { "unset_deleted", dm_unset_deleted, 1, 0 },
+ { "unset_draft", dm_unset_draft, 1, 0 },
+ { "unset_recent", dm_unset_recent, 1, 0 },
+ { "unset_read", dm_unset_read, 1, 0 },
+ { "expunge", dm_expunge, 0, 0 },
+ { "sync", dm_sync, 0, 0 },
+ { "append", dm_append, 0, 1 },
+
{ NULL }
};
-static dm_action
-get_action (char const *s, size_t *narg)
+static struct dm_action *
+get_action (char const *s)
{
size_t i;
for (i = 0; actions[i].name; i++)
if (strcmp (actions[i].name, s) == 0)
- {
- *narg = actions[i].narg;
- return actions[i].act;
- }
+ return &actions[i];
return NULL;
}
@@ -276,7 +293,12 @@ main (int argc, char **argv)
mu_mailbox_t mbx;
mu_message_t msg = NULL;
char *mailbox_name = getenv ("MAIL");
- size_t n;
+ size_t msgno;
+ char *buf = NULL;
+ size_t size = 0, n;
+ struct mu_wordsplit ws;
+ int wsflags;
+ int rc;
mu_set_program_name (argv[0]);
mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
@@ -295,73 +317,61 @@ main (int argc, char **argv)
MU_ASSERT (mu_mailbox_create_default (&mbx, mailbox_name));
MU_ASSERT (mu_mailbox_open (mbx, MU_STREAM_RDWR));
-
- while (argc--)
+
+ wsflags = MU_WRDSF_DEFFLAGS
+ | MU_WRDSF_COMMENT
+ | MU_WRDSF_ALLOC_DIE
+ | MU_WRDSF_SHOWERR;
+ ws.ws_comment = "#";
+
+ while ((rc = mu_stream_getline (mu_strin, &buf, &size, &n)) == 0 && n > 0)
{
- char *a = *argv++;
- dm_action f;
- size_t narg;
+ struct dm_action *act;
- if (mu_isdigit (*a))
- {
- n = get_num (a);
- MU_ASSERT (mu_mailbox_get_message (mbx, n, &msg));
- continue;
- }
+ mu_ltrim_class (buf, MU_CTYPE_SPACE);
+ mu_rtrim_class (buf, MU_CTYPE_SPACE);
- if (strcmp (a, "expunge") == 0)
- {
- MU_ASSERT (mu_mailbox_expunge (mbx));
- mu_printf ("expunge: OK\n");
- continue;
- }
+ MU_ASSERT (mu_wordsplit (buf, &ws, wsflags));
+ wsflags |= MU_WRDSF_REUSE;
- if (strcmp (a, "sync") == 0)
+ if (ws.ws_wordc == 0)
+ continue;
+
+ if (mu_isdigit (*ws.ws_wordv[0]))
{
- MU_ASSERT (mu_mailbox_sync (mbx));
- mu_printf ("sync: OK\n");
+ msgno = get_num (ws.ws_wordv[0]);
+ MU_ASSERT (mu_mailbox_get_message (mbx, msgno, &msg));
+ mu_printf ("%lu current message\n", (unsigned long) msgno);
continue;
}
- if (strcmp (a, "append") == 0)
+ act = get_action (ws.ws_wordv[0]);
+ if (!act)
{
- if (argc < 1)
- {
- mu_error ("not enough arguments for %s", a);
- return 1;
- }
- dmbox_append (mbx, argv[0]);
- argc--;
- argv++;
- continue;
- }
-
- f = get_action (a, &narg);
- if (!f)
- {
- mu_error ("%s: unrecognized action", a);
+ mu_error ("%s: unrecognized action", ws.ws_wordv[0]);
return 1;
}
- if (!msg)
+ if (act->needs_message && !msg)
{
mu_error ("no message selected");
return 1;
}
- if (narg > argc)
+ if (act->narg + 1 != ws.ws_wordc)
{
- mu_error ("not enough arguments for %s", a);
+ mu_error ("bad number of arguments for %s", ws.ws_wordv[0]);
return 1;
}
-
- mu_printf ("%lu %s: ", (unsigned long) n, a);
- f (msg, argv);
- mu_printf ("\n");
- argc -= narg;
- argv += narg;
+ if (act->needs_message)
+ mu_printf ("%lu ", (unsigned long) msgno);
+ mu_printf ("%s: ", ws.ws_wordv[0]);
+ act->fn (mbx, msg, ws.ws_wordv + 1);
+ mu_printf ("\n");
}
+ if (wsflags & MU_WRDSF_REUSE)
+ mu_wordsplit_free (&ws);
mu_mailbox_close (mbx);
mu_mailbox_destroy (&mbx);
return 0;
diff --git a/libproto/dotmail/tests/env.at b/libproto/dotmail/tests/env.at
index ba9a45a..8d097b5 100644
--- a/libproto/dotmail/tests/env.at
+++ b/libproto/dotmail/tests/env.at
@@ -14,8 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-DM_TEST([env],
-[dm_mesg 1 env_date env_sender],
+DM_MESG([env],
[Received: (from hare@wonder.land)
by wonder.land id 3301
for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -30,6 +29,12 @@ Return-Path: hare@example.com
Have some wine
.
],
-[1 env_date: Mon Jul 29 21:00:06 2002
+[],[],
+[1
+env_date
+env_sender
+],
+[1 current message
+1 env_date: Mon Jul 29 21:00:06 2002
1 env_sender: hare@example.com
])
diff --git a/libproto/dotmail/tests/header.at b/libproto/dotmail/tests/header.at
index b95a252..60e93f7 100644
--- a/libproto/dotmail/tests/header.at
+++ b/libproto/dotmail/tests/header.at
@@ -14,8 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-DM_TEST([header],
-[dm_mesg 1 header_lines header_size header_count 2 header_lines header_size header_count],
+DM_MESG([header],
[Received: (from hare@wonder.land)
by wonder.land id 3301
for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -38,16 +37,27 @@ Return-Path: alice@wonder.land
I don't see any wine
.
],
-[1 header_lines: 10
+[],[],
+[1
+header_lines
+header_size
+header_count
+2
+header_lines
+header_size
+header_count
+],
+[1 current message
+1 header_lines: 10
1 header_size: 315
1 header_count: 7
+2 current message
2 header_lines: 7
2 header_size: 206
2 header_count: 6
])
-DM_TEST([headers],
-[dm_mesg 1 headers 2 headers],
+DM_MESG([headers],
[Received: (from hare@wonder.land)
by wonder.land id 3301
for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -70,7 +80,14 @@ Return-Path: alice@wonder.land
I don't see any wine
.
],
-[1 headers: Received:(from hare@wonder.land) by wonder.land id 3301 for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
+[],[],
+[1
+headers
+2
+headers
+],
+[1 current message
+1 headers: Received:(from hare@wonder.land) by wonder.land id 3301 for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
Date:Mon, 29 Jul 2002 22:00:01 +0100
From:March Hare <hare@wonder.land>
Message-Id:<200207292200.3301@wonder.land>
@@ -78,6 +95,7 @@ To:Alice <alice@wonder.land>
Subject:Invitation
Return-Path:hare@wonder.land
+2 current message
2 headers: Date:Mon, 29 Jul 2002 22:00:02 +0100
From:Alice <alice@wonder.land>
Message-Id:<200207292200.3302@wonder.land>
diff --git a/libproto/dotmail/tests/setattr.at b/libproto/dotmail/tests/setattr.at
new file mode 100644
index 0000000..8a4415c
--- a/dev/null
+++ b/libproto/dotmail/tests/setattr.at
@@ -0,0 +1,138 @@
+# GNU Mailutils -- a suite of utilities for electronic mail
+# Copyright (C) 2019 Free Software Foundation, Inc.
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
+
+DM_MESG([set attributes],
+[Received: (from hare@wonder.land)
+ by wonder.land id 3301
+ for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
+Date: Mon, 29 Jul 2002 22:00:01 +0100
+From: March Hare <hare@wonder.land>
+Message-Id: <200207292200.3301@wonder.land>
+To: Alice <alice@wonder.land>
+Subject: Invitation
+Return-Path: hare@wonder.land
+
+Have some wine
+.
+Received: (from alice@wonder.land)
+ by wonder.land id 3302
+ for hare@wonder.land; Mon, 29 Jul 2002 22:00:07 +0100
+Date: Mon, 29 Jul 2002 22:00:02 +0100
+From: Alice <alice@wonder.land>
+Message-Id: <200207292200.3302@wonder.land>
+To: March Hare <hare@wonder.land>
+Subject: Re: Invitation
+Return-Path: alice@wonder.land
+
+I don't see any wine
+.
+Received: (from hare@wonder.land)
+ by wonder.land id 3303
+ for alice@wonder.land; Mon, 29 Jul 2002 22:00:08 +0100
+Date: Mon, 29 Jul 2002 22:00:03 +0100
+From: March Hare <hare@wonder.land>
+Message-Id: <200207292200.3303@wonder.land>
+To: Alice <alice@wonder.land>
+Subject: Re: Invitation
+Return-Path: hare@wonder.land
+
+There isn't any
+.
+Received: (from alice@wonder.land)
+ by wonder.land id 3304
+ for hare@wonder.land; Mon, 29 Jul 2002 22:00:09 +0100
+Date: Mon, 29 Jul 2002 22:00:04 +0100
+From: Alice <alice@wonder.land>
+Message-Id: <200207292200.3304@wonder.land>
+To: March Hare <hare@wonder.land>
+Subject: Re: Invitation
+Return-Path: alice@wonder.land
+
+Then it wasn't very civil of you to offer it
+.
+Received: (from hare@wonder.land)
+ by wonder.land id 3305
+ for alice@wonder.land; Mon, 29 Jul 2002 22:00:10 +0100
+Date: Mon, 29 Jul 2002 22:00:05 +0100
+From: March Hare <hare@wonder.land>
+Message-Id: <200207292200.3305@wonder.land>
+To: Alice <alice@wonder.land>
+Subject: Re: Invitation
+Return-Path: hare@wonder.land
+
+It wasn't very civil of you to sit down without being invited
+.
+],
+[],[],
+[# Select 3rd message
+3
+# Display its attributes
+attr
+# Set the Read attribute
+set_read
+# Set the Draft attribute
+set_draft
+# Display modified attributes
+attr
+# Synchronize the mailbox with disk storage
+sync
+# Display modified attributes: should be the same as before
+attr
+# Display all headers; the Status header is missing, because
+# the mu_header_t object was not notified about the change.
+# Not sure if that's right, but that's the way the library works now.
+headers
+# Display the message text; this is to make sure all offsets
+# in the mu_dotmail_message structure have been updated correctly
+# after the change.
+body_text
+# Select fourth message
+4
+# The following two commands make sure offsets in the subsequent messages
+# are all fixed up.
+headers
+body_text
+],
+[3 current message
+3 attr: -
+3 set_read: OK
+3 set_draft: OK
+3 attr: dR
+sync: OK
+3 attr: dR
+3 headers: Received:(from hare@wonder.land) by wonder.land id 3303 for alice@wonder.land; Mon, 29 Jul 2002 22:00:08 +0100
+Date:Mon, 29 Jul 2002 22:00:03 +0100
+From:March Hare <hare@wonder.land>
+Message-Id:<200207292200.3303@wonder.land>
+To:Alice <alice@wonder.land>
+Subject:Re: Invitation
+Return-Path:hare@wonder.land
+
+3 body_text: There isn't any
+
+4 current message
+4 headers: Received:(from alice@wonder.land) by wonder.land id 3304 for hare@wonder.land; Mon, 29 Jul 2002 22:00:09 +0100
+Date:Mon, 29 Jul 2002 22:00:04 +0100
+From:Alice <alice@wonder.land>
+Message-Id:<200207292200.3304@wonder.land>
+To:March Hare <hare@wonder.land>
+Subject:Re: Invitation
+Return-Path:alice@wonder.land
+
+4 body_text: Then it wasn't very civil of you to offer it
+
+])
+
diff --git a/libproto/dotmail/tests/testsuite.at b/libproto/dotmail/tests/testsuite.at
index 10e7348..12a3b50 100644
--- a/libproto/dotmail/tests/testsuite.at
+++ b/libproto/dotmail/tests/testsuite.at
@@ -28,6 +28,22 @@ $2
[0],
[$4])
AT_CLEANUP])
+
+dnl DM_MESG([NAME],[MBOX],[PRE],[POST],[INPUT],[OUTPUT])
+m4_define([DM_MESG],
+ [AT_SETUP($1)
+AT_CHECK(
+ [AT_DATA([dmbx],[$2])
+AT_DATA([input],[$5])
+MAIL=./dmbx
+export MAIL
+$3
+dm_mesg < input
+$4
+],
+[0],
+[$6])
+AT_CLEANUP])
AT_INIT
m4_include([count.at])
@@ -43,4 +59,5 @@ m4_include([qget.at])
m4_include([append.at])
m4_include([delete.at])
m4_include([autodetect.at])
+m4_include([setattr.at])
diff --git a/libproto/dotmail/tests/uid.at b/libproto/dotmail/tests/uid.at
index c39d140..28581b5 100644
--- a/libproto/dotmail/tests/uid.at
+++ b/libproto/dotmail/tests/uid.at
@@ -14,8 +14,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
-DM_TEST([uid],
-[dm_mesg 1 uid 2 uid 3 uid],
+DM_MESG([uid],
[Received: (from hare@wonder.land)
by wonder.land id 3301
for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100
@@ -56,7 +55,18 @@ Return-Path: hare@wonder.land
There isn't any
.
],
-[1 uid: 1
+[],[],
+[1
+uid
+2
+uid
+3
+uid
+],
+[1 current message
+1 uid: 1
+2 current message
2 uid: 2
+3 current message
3 uid: 1001
])

Return to:

Send suggestions and report system problems to the System administrator.