diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-03-02 15:40:18 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-03-02 16:08:43 +0200 |
commit | 4d422ec9bf22cb45785ed7a17a60d0d7b2bb013b (patch) | |
tree | 8121a557819cc66c07d3d03c7118547e1cd005ed | |
parent | 1ed195f6b39a8ded621ebb00b04b0418b8cc4e8f (diff) | |
download | mailutils-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.
-rw-r--r-- | libproto/dotmail/tests/Makefile.am | 3 | ||||
-rw-r--r-- | libproto/dotmail/tests/append.at | 43 | ||||
-rw-r--r-- | libproto/dotmail/tests/attr.at | 13 | ||||
-rw-r--r-- | libproto/dotmail/tests/body.at | 15 | ||||
-rw-r--r-- | libproto/dotmail/tests/delete.at | 29 | ||||
-rw-r--r-- | libproto/dotmail/tests/dm_mesg.c | 216 | ||||
-rw-r--r-- | libproto/dotmail/tests/env.at | 11 | ||||
-rw-r--r-- | libproto/dotmail/tests/header.at | 30 | ||||
-rw-r--r-- | libproto/dotmail/tests/setattr.at | 138 | ||||
-rw-r--r-- | libproto/dotmail/tests/testsuite.at | 17 | ||||
-rw-r--r-- | libproto/dotmail/tests/uid.at | 16 |
11 files changed, 387 insertions, 144 deletions
diff --git a/libproto/dotmail/tests/Makefile.am b/libproto/dotmail/tests/Makefile.am index a033346e7..8139e51b4 100644 --- a/libproto/dotmail/tests/Makefile.am +++ b/libproto/dotmail/tests/Makefile.am @@ -67,3 +67,4 @@ TESTSUITE_AT = \ append.at\ - delete.at + delete.at\ + setattr.at diff --git a/libproto/dotmail/tests/append.at b/libproto/dotmail/tests/append.at index 141643019..a474edf61 100644 --- a/libproto/dotmail/tests/append.at +++ b/libproto/dotmail/tests/append.at @@ -16,19 +16,3 @@ -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) @@ -70,3 +54,28 @@ 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 diff --git a/libproto/dotmail/tests/attr.at b/libproto/dotmail/tests/attr.at index 0439dcb1b..11694e5fb 100644 --- a/libproto/dotmail/tests/attr.at +++ b/libproto/dotmail/tests/attr.at @@ -16,4 +16,3 @@ -DM_TEST([attr], -[dm_mesg 1 attr 2 attr], +DM_MESG([attr], [Received: (from hare@wonder.land) @@ -44,3 +43,11 @@ 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 f0c383640..cb16cac02 100644 --- a/libproto/dotmail/tests/body.at +++ b/libproto/dotmail/tests/body.at @@ -16,4 +16,3 @@ -DM_TEST([body], -[dm_mesg 1 body_lines body_size 2 body_lines body_size], +DM_MESG([body], [Received: (from alice@wonder.land) @@ -46,4 +45,14 @@ 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 diff --git a/libproto/dotmail/tests/delete.at b/libproto/dotmail/tests/delete.at index b97d3f0c6..212be15c5 100644 --- a/libproto/dotmail/tests/delete.at +++ b/libproto/dotmail/tests/delete.at @@ -16,6 +16,3 @@ -DM_TEST([delete], -[dm_mesg 3 set_deleted expunge 3 body_text -dm_mbox count -], +DM_MESG([delete], [Received: (from hare@wonder.land) @@ -69,4 +66,26 @@ 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 diff --git a/libproto/dotmail/tests/dm_mesg.c b/libproto/dotmail/tests/dm_mesg.c index 6dbda92c7..bc868a39a 100644 --- a/libproto/dotmail/tests/dm_mesg.c +++ b/libproto/dotmail/tests/dm_mesg.c @@ -34,3 +34,3 @@ 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) { @@ -46,3 +46,3 @@ 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) { @@ -58,3 +58,3 @@ 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) { @@ -68,3 +68,3 @@ 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) { @@ -78,3 +78,3 @@ 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) { @@ -88,3 +88,3 @@ 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) { @@ -99,3 +99,3 @@ 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) { @@ -110,3 +110,3 @@ 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) { @@ -129,3 +129,3 @@ 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) { @@ -139,3 +139,3 @@ 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) { @@ -149,3 +149,3 @@ 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) { @@ -160,3 +160,3 @@ 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) { @@ -170,3 +170,3 @@ 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) { @@ -182,3 +182,3 @@ dm_uid (mu_message_t msg, char **argv) 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) \ { \ @@ -207,49 +207,69 @@ 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 } @@ -257,4 +277,4 @@ static struct -static dm_action -get_action (char const *s, size_t *narg) +static struct dm_action * +get_action (char const *s) { @@ -264,6 +284,3 @@ get_action (char const *s, size_t *narg) if (strcmp (actions[i].name, s) == 0) - { - *narg = actions[i].narg; - return actions[i].act; - } + return &actions[i]; @@ -278,3 +295,8 @@ main (int argc, char **argv) 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; @@ -297,27 +319,27 @@ main (int argc, char **argv) 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; @@ -325,19 +347,6 @@ main (int argc, char **argv) - 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; @@ -345,3 +354,3 @@ main (int argc, char **argv) - if (!msg) + if (act->needs_message && !msg) { @@ -351,15 +360,16 @@ main (int argc, char **argv) - 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); diff --git a/libproto/dotmail/tests/env.at b/libproto/dotmail/tests/env.at index ba9a45ae5..8d097b5dd 100644 --- a/libproto/dotmail/tests/env.at +++ b/libproto/dotmail/tests/env.at @@ -16,4 +16,3 @@ -DM_TEST([env], -[dm_mesg 1 env_date env_sender], +DM_MESG([env], [Received: (from hare@wonder.land) @@ -32,3 +31,9 @@ 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 b95a25297..60e93f72d 100644 --- a/libproto/dotmail/tests/header.at +++ b/libproto/dotmail/tests/header.at @@ -16,4 +16,3 @@ -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) @@ -40,5 +39,17 @@ 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 @@ -48,4 +59,3 @@ I don't see any wine -DM_TEST([headers], -[dm_mesg 1 headers 2 headers], +DM_MESG([headers], [Received: (from hare@wonder.land) @@ -72,3 +82,10 @@ 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 @@ -80,2 +97,3 @@ Return-Path:hare@wonder.land +2 current message 2 headers: Date:Mon, 29 Jul 2002 22:00:02 +0100 diff --git a/libproto/dotmail/tests/setattr.at b/libproto/dotmail/tests/setattr.at new file mode 100644 index 000000000..8a4415c3b --- /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 10e73489f..12a3b506e 100644 --- a/libproto/dotmail/tests/testsuite.at +++ b/libproto/dotmail/tests/testsuite.at @@ -30,2 +30,18 @@ $2 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]) @@ -45,2 +61,3 @@ 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 c39d1406c..28581b5ac 100644 --- a/libproto/dotmail/tests/uid.at +++ b/libproto/dotmail/tests/uid.at @@ -16,4 +16,3 @@ -DM_TEST([uid], -[dm_mesg 1 uid 2 uid 3 uid], +DM_MESG([uid], [Received: (from hare@wonder.land) @@ -58,4 +57,15 @@ 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 |