summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-11-16 09:44:44 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-11-16 09:48:03 +0200
commit500bab2e34400206f0e8982b11d6cc07fac52ffa (patch)
treed0cc7f0918a7c2de31b1df77052f46130a20e308
parentd7110faad78c2095ca39e380a7a3a6cdff413b2e (diff)
downloadmailutils-500bab2e34400206f0e8982b11d6cc07fac52ffa.tar.gz
mailutils-500bab2e34400206f0e8982b11d6cc07fac52ffa.tar.bz2
Write testsuite for mh mailbox library
* libmailutils/base/amd.c (amd_get_attr_flags): Scan the message if AMD does not report MU_AMD_STATUS capability. * libproto/mh/mbox.c (mh_qfetch): Fix, * libproto/mh/Makefile.am (SUBDIRS): Add tests. * libproto/mh/tests/.gitignore: New file. * libproto/mh/tests/Makefile.am: New file. * libproto/mh/tests/append.at: New file. * libproto/mh/tests/atlocal.in: New file. * libproto/mh/tests/attr.at: New file. * libproto/mh/tests/autodetect.at: New file. * libproto/mh/tests/body.at: New file. * libproto/mh/tests/count.at: New file. * libproto/mh/tests/delete.at: New file. * libproto/mh/tests/envelope.at: New file. * libproto/mh/tests/header.at: New file. * libproto/mh/tests/qget.at: New file. * libproto/mh/tests/testsuite.at: New file. * libproto/mh/tests/uid.at: New file. * libproto/mh/tests/uidvalidity.at: New file.
-rw-r--r--libmailutils/base/amd.c9
-rw-r--r--libproto/mh/Makefile.am1
-rw-r--r--libproto/mh/mbox.c19
-rw-r--r--libproto/mh/tests/.gitignore8
-rw-r--r--libproto/mh/tests/Makefile.am55
-rw-r--r--libproto/mh/tests/append.at71
-rw-r--r--libproto/mh/tests/atlocal.in6
-rw-r--r--libproto/mh/tests/attr.at66
-rw-r--r--libproto/mh/tests/autodetect.at48
-rw-r--r--libproto/mh/tests/body.at83
-rw-r--r--libproto/mh/tests/count.at26
-rw-r--r--libproto/mh/tests/delete.at49
-rw-r--r--libproto/mh/tests/envelope.at25
-rw-r--r--libproto/mh/tests/header.at58
-rw-r--r--libproto/mh/tests/qget.at38
-rw-r--r--libproto/mh/tests/testsuite.at37
-rw-r--r--libproto/mh/tests/uid.at43
-rw-r--r--libproto/mh/tests/uidvalidity.at35
18 files changed, 662 insertions, 15 deletions
diff --git a/libmailutils/base/amd.c b/libmailutils/base/amd.c
index aca704dbd..9b8728d15 100644
--- a/libmailutils/base/amd.c
+++ b/libmailutils/base/amd.c
@@ -2037,6 +2037,15 @@ amd_get_attr_flags (mu_attribute_t attr, int *pflags)
if (mhm == NULL)
return EINVAL;
+ if (!(mhm->amd->capabilities & MU_AMD_STATUS))
+ {
+ /* If AMD implementation doesn't handle status (attribute) bits, they
+ must be retrieved from the Status: header. To ensure that, the
+ message must be scanned: */
+ int rc = amd_check_message (mhm);
+ if (rc)
+ return rc;
+ }
if (pflags)
*pflags = mhm->attr_flags;
return 0;
diff --git a/libproto/mh/Makefile.am b/libproto/mh/Makefile.am
index e1c12b33f..24a4bc996 100644
--- a/libproto/mh/Makefile.am
+++ b/libproto/mh/Makefile.am
@@ -24,4 +24,5 @@ libmu_mh_la_SOURCES = \
mbox.c\
profile.c
+SUBDIRS = . tests
diff --git a/libproto/mh/mbox.c b/libproto/mh/mbox.c
index a37a3f27a..6d0ebfa45 100644
--- a/libproto/mh/mbox.c
+++ b/libproto/mh/mbox.c
@@ -353,30 +353,19 @@ mh_size (mu_mailbox_t mailbox, mu_off_t *psize)
static int
mh_qfetch (struct _amd_data *amd, mu_message_qid_t qid)
{
- char *p;
+ char *p = (char *)qid;
size_t num = 0;
int attr_flags = 0;
struct _mh_message *msg;
- p = qid + strlen (qid) - 1;
- if (!mu_isdigit (*p))
- return EINVAL;
-
- for (p--; p >= qid && mu_isdigit (*p); p--)
- ;
-
- if (p == qid)
- return EINVAL;
-
- num = strtoul (p + 1, NULL, 10);
-
if (*p == ',')
{
attr_flags |= MU_ATTRIBUTE_DELETED;
- p--;
+ p++;
}
- if (*p != '/')
+ num = strtoul (p, &p, 10);
+ if ((num == ULONG_MAX && errno == ERANGE) || *p != 0)
return EINVAL;
msg = calloc (1, sizeof (*msg));
diff --git a/libproto/mh/tests/.gitignore b/libproto/mh/tests/.gitignore
new file mode 100644
index 000000000..5f954808c
--- /dev/null
+++ b/libproto/mh/tests/.gitignore
@@ -0,0 +1,8 @@
+/atconfig
+/atlocal
+/mbop
+/package.m4
+/testsuite
+/testsuite.dir
+/testsuite.log
+
diff --git a/libproto/mh/tests/Makefile.am b/libproto/mh/tests/Makefile.am
new file mode 100644
index 000000000..aadccf074
--- /dev/null
+++ b/libproto/mh/tests/Makefile.am
@@ -0,0 +1,55 @@
+# This file is part of GNU Mailutils.
+# Copyright (C) 2019-2020 Free Software Foundation, Inc.
+#
+# GNU Mailutils is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3, or (at
+# your option) any later version.
+#
+# GNU Mailutils 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
+
+include $(top_srcdir)/testsuite/testsuite.am
+
+## -------------------------- ##
+## Non-installable programs
+## -------------------------- ##
+
+AM_CPPFLAGS = \
+ $(MU_LIB_COMMON_INCLUDES) \
+ -I$(top_srcdir)/libmailutils/tests \
+ -DMBOP_RECORD=mu_mh_record \
+ -DMBOP_SCHEME=\"mh\"
+noinst_PROGRAMS = \
+ mbop
+
+LDADD = -L$(top_builddir)/libmailutils/tests -lmu_tesh $(MU_LIB_MH) $(MU_LIB_MAILUTILS)
+
+VPATH += $(top_srcdir)/testsuite
+nodist_mbop_SOURCES = mbop.c
+
+## ------------ ##
+## Test suite. ##
+## ------------ ##
+
+TESTSUITE_AT += \
+ append.at\
+ attr.at\
+ autodetect.at\
+ body.at\
+ count.at\
+ delete.at\
+ envelope.at\
+ header.at\
+ qget.at\
+ uid.at\
+ uidvalidity.at
+
+
+
+
diff --git a/libproto/mh/tests/append.at b/libproto/mh/tests/append.at
new file mode 100644
index 000000000..f36aa5127
--- /dev/null
+++ b/libproto/mh/tests/append.at
@@ -0,0 +1,71 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([append])
+AT_CHECK([mbox2dir -m -p -v 10 -u inbox $spooldir/mbox1])
+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
+])
+AT_DATA([commands],
+[append msg
+count
+6
+uid
+env_date
+env_sender
+headers
+body_text
+])
+AT_CHECK([
+mbop -m inbox < commands
+],
+[0],
+[append: OK
+count: 6
+6 current message
+6 uid: 6
+6 env_date: Mon Jul 29 21:00:09 2002
+6 env_sender: alice@wonder.land
+6 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
+X-Envelope-Date:Mon Jul 29 21:00:09 2002
+X-Envelope-Sender:alice@wonder.land
+
+6 body_text: Then it wasn't very civil of you to offer it
+
+])
+AT_CHECK([
+mbop -m inbox uidvalidity
+],
+[0],
+[uidvalidity: 10
+])
+AT_CLEANUP
diff --git a/libproto/mh/tests/atlocal.in b/libproto/mh/tests/atlocal.in
new file mode 100644
index 000000000..fd440e2ad
--- /dev/null
+++ b/libproto/mh/tests/atlocal.in
@@ -0,0 +1,6 @@
+# @configure_input@ -*- shell-script -*-
+# Configurable variable values for Mailutils test suite.
+# Copyright (C) 2004-2020 Free Software Foundation, Inc.
+
+PATH=@abs_builddir@:@abs_top_builddir@/testsuite:$PATH
+spooldir=$abs_top_srcdir/testsuite/spool/
diff --git a/libproto/mh/tests/attr.at b/libproto/mh/tests/attr.at
new file mode 100644
index 000000000..94e10deb5
--- /dev/null
+++ b/libproto/mh/tests/attr.at
@@ -0,0 +1,66 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([attributes])
+AT_CHECK([mbox2dir -m inbox $spooldir/mbox1])
+
+AT_CHECK([
+mbop -m inbox 1 \; attr \; 2 \; attr
+],
+[0],
+[1 current message
+1 attr: -
+2 current message
+2 attr: -
+])
+AT_CHECK([
+AT_DATA([commands],
+[# Select 3rd message
+3
+# Set the read attribute
+set_read
+# Set the draft attribute
+set_draft
+# Select 5th message
+5
+# Set the answered attribute
+set_answered
+set_seen
+# Synchronize with the disk storage
+sync
+])
+mbop -m inbox < commands
+],
+[0],
+[3 current message
+3 set_read: OK
+3 set_draft: OK
+5 current message
+5 set_answered: OK
+5 set_seen: OK
+sync: OK
+])
+AT_CHECK([
+mbop -m inbox 3 \; attr \; 5 \; attr
+],
+[0],
+[3 current message
+3 attr: dR
+5 current message
+5 attr: AO
+])
+AT_CLEANUP
+
diff --git a/libproto/mh/tests/autodetect.at b/libproto/mh/tests/autodetect.at
new file mode 100644
index 000000000..81f914017
--- /dev/null
+++ b/libproto/mh/tests/autodetect.at
@@ -0,0 +1,48 @@
+# GNU Mailutils -- a suite of utilities for electronic mail
+# Copyright (C) 2020 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/>.
+AT_SETUP([format detection])
+AT_KEYWORDS([autodetect])
+AT_CHECK([
+mkdir inbox
+mbop -m inbox --detect
+],
+[1],
+[inbox: 0
+])
+AT_CHECK([
+touch inbox/.mh_sequences
+mbop -m inbox --detect
+],
+[0],
+[inbox: 2
+])
+AT_CHECK([
+rm inbox/.mh_sequences
+touch inbox/1
+mbop -m inbox --detect
+],
+[0],
+[inbox: 2
+])
+AT_CHECK([
+mv inbox/1 inbox/,1
+mbop -m inbox --detect
+],
+[0],
+[inbox: 2
+])
+
+AT_CLEANUP
diff --git a/libproto/mh/tests/body.at b/libproto/mh/tests/body.at
new file mode 100644
index 000000000..afb11574b
--- /dev/null
+++ b/libproto/mh/tests/body.at
@@ -0,0 +1,83 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([body])
+AT_DATA([commands],
+[1
+body_lines
+body_size
+body_text
+2
+body_lines
+body_size
+body_text
+])
+AT_CHECK([mbox2dir -m inbox $spooldir/mbox1])
+
+AT_CHECK([
+mbop -m inbox < commands
+],
+[0],
+[1 current message
+1 body_lines: 35
+1 body_size: 937
+1 body_text: `Twas brillig, and the slithy toves
+Did gyre and gimble in the wabe;
+All mimsy were the borogoves,
+And the mome raths outgrabe.
+
+`Beware the Jabberwock, my son!
+The jaws that bite, the claws that catch!
+Beware the Jujub bird, and shun
+The frumious Bandersnatch!'
+
+He took his vorpal sword in hand:
+Long time the manxome foe he sought --
+So rested he by the Tumtum gree,
+And stood awhile in thought.
+
+And as in uffish thought he stood,
+The Jabberwock, with eyes of flame,
+Came whiffling through the tulgey wook,
+And burbled as it came!
+
+One, two! One, two! And through and through
+The vorpal blade went snicker-snack!
+He left it dead, and with its head
+He went galumphing back.
+
+`And has thou slain the Jabberwock?
+Come to my arms, my beamish boy!
+O frabjous day! Calloh! Callay!
+He chortled in his joy.
+
+`Twas brillig, and the slithy toves
+Did gyre and gimble in the wabe;
+All mimsy were the borogoves,
+And the mome raths outgrabe.
+
+
+2 current message
+2 body_lines: 4
+2 body_size: 215
+2 body_text: It seems very pretty, but it's *rather* hard to understand!'
+Somehow it seems to fill my head with ideas -- only I don't
+exactly know what they are! However, SOMEBODY killed SOMETHING:
+that's clear, at any rate...
+
+])
+AT_CLEANUP
+
diff --git a/libproto/mh/tests/count.at b/libproto/mh/tests/count.at
new file mode 100644
index 000000000..473693ce4
--- /dev/null
+++ b/libproto/mh/tests/count.at
@@ -0,0 +1,26 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([message count])
+AT_CHECK([mbox2dir -m inbox $spooldir/mbox1])
+
+AT_CHECK([
+mbop -m inbox count
+],
+[0],
+[count: 5
+])
+AT_CLEANUP
diff --git a/libproto/mh/tests/delete.at b/libproto/mh/tests/delete.at
new file mode 100644
index 000000000..7553fa93d
--- /dev/null
+++ b/libproto/mh/tests/delete.at
@@ -0,0 +1,49 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([delete])
+AT_CHECK([mbox2dir -m -p -v 10 -u inbox $spooldir/mbox1])
+AT_DATA([commands],
+[3
+set_deleted
+expunge
+# Message 4 becomes 3 after expunge. Re-select it.
+3
+uid
+headers
+])
+AT_CHECK([
+mbop -m inbox < commands
+],
+[0],
+[3 current message
+3 set_deleted: OK
+expunge: OK
+3 current message
+3 uid: 4
+3 headers: Organization:Mailutils-tests
+Received:from example.net (localhost [[127.0.0.1]]) by example.net with ESMTP id g6CLowb05126 for <gray@example.net>; Sat, 13 Jul 2002 00:50:58 +0300
+Message-Id:<200207122150.g6CLowb05126@example.net>
+To:Foo Bar <foobar@nonexistent.net>
+Subject:Nested MIME
+MIME-Version:1.0
+Content-Type:multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+Content-ID:<5122.1026510654.1@example.net>
+Date:Sat, 13 Jul 2002 00:50:58 +0300
+From:Sergey Poznyakoff <gray@example.net>
+
+])
+AT_CLEANUP
diff --git a/libproto/mh/tests/envelope.at b/libproto/mh/tests/envelope.at
new file mode 100644
index 000000000..9d67be759
--- /dev/null
+++ b/libproto/mh/tests/envelope.at
@@ -0,0 +1,25 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([envelope])
+AT_CHECK([mbox2dir -m inbox $spooldir/mbox1])
+AT_CHECK([mbop -m inbox 2 \; env_date \; env_sender],
+[0],
+[2 current message
+2 env_date: Fri Dec 28 20:18:08 2001
+2 env_sender: bar@dontmailme.org
+])
+AT_CLEANUP
diff --git a/libproto/mh/tests/header.at b/libproto/mh/tests/header.at
new file mode 100644
index 000000000..b69420c5b
--- /dev/null
+++ b/libproto/mh/tests/header.at
@@ -0,0 +1,58 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([header])
+AT_DATA([commands],
+[1
+header_lines
+header_size
+header_count
+headers
+2
+header_lines
+header_size
+header_count
+headers
+])
+AT_CHECK([mbox2dir -m inbox $spooldir/mbox1])
+AT_CHECK([
+mbop -m inbox < commands
+],
+[0],
+[1 current message
+1 header_lines: 9
+1 header_size: 317
+1 header_count: 6
+1 headers: Received:(from foobar@nonexistent.net) by nonexistent.net id fBSKI8N04906 for bar@dontmailme.org; Fri, 28 Dec 2001 22:18:08 +0200
+Date:Fri, 28 Dec 2001 22:18:08 +0200
+From:Foo Bar <foobar@nonexistent.net>
+Message-Id:<200112282018.fBSKI8N04906@nonexistent.net>
+To:Bar <bar@dontmailme.org>
+Subject:Jabberwocky
+
+2 current message
+2 header_lines: 9
+2 header_size: 319
+2 header_count: 6
+2 headers: Received:(from bar@dontmailme.org) by dontmailme.org id fERKR9N16790 for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
+Date:Fri, 28 Dec 2001 23:28:08 +0200
+From:Bar <bar@dontmailme.org>
+To:Foo Bar <foobar@nonexistent.net>
+Message-Id:<200112232808.fERKR9N16790@dontmailme.org>
+Subject:Re: Jabberwocky
+
+])
+AT_CLEANUP
diff --git a/libproto/mh/tests/qget.at b/libproto/mh/tests/qget.at
new file mode 100644
index 000000000..e43a7ad56
--- /dev/null
+++ b/libproto/mh/tests/qget.at
@@ -0,0 +1,38 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([qget access])
+AT_CHECK([mbox2dir -m -p -v 10 inbox $spooldir/mbox1])
+AT_CHECK([
+mbop -m inbox qget 2
+],
+[0],
+[qget: Received: (from bar@dontmailme.org)
+ by dontmailme.org id fERKR9N16790
+ for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
+Date: Fri, 28 Dec 2001 23:28:08 +0200
+From: Bar <bar@dontmailme.org>
+To: Foo Bar <foobar@nonexistent.net>
+Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
+Subject: Re: Jabberwocky
+
+It seems very pretty, but it's *rather* hard to understand!'
+Somehow it seems to fill my head with ideas -- only I don't
+exactly know what they are! However, SOMEBODY killed SOMETHING:
+that's clear, at any rate...
+
+])
+AT_CLEANUP
diff --git a/libproto/mh/tests/testsuite.at b/libproto/mh/tests/testsuite.at
new file mode 100644
index 000000000..c1b18ce41
--- /dev/null
+++ b/libproto/mh/tests/testsuite.at
@@ -0,0 +1,37 @@
+# GNU Mailutils -- a suite of utilities for electronic mail
+# Copyright (C) 2019-2020 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/>.
+
+m4_include([testsuite.inc])
+
+AT_INIT
+m4_include([autodetect.at])
+
+m4_include([count.at])
+
+m4_include([attr.at])
+m4_include([envelope.at])
+m4_include([header.at])
+m4_include([body.at])
+m4_include([uid.at])
+m4_include([uidvalidity.at])
+m4_include([qget.at])
+
+m4_include([append.at])
+m4_include([delete.at])
+
+# Local Variables:
+# mode: autotest
+# End:
diff --git a/libproto/mh/tests/uid.at b/libproto/mh/tests/uid.at
new file mode 100644
index 000000000..990359387
--- /dev/null
+++ b/libproto/mh/tests/uid.at
@@ -0,0 +1,43 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([uid])
+AT_DATA([names],
+[1
+20
+22
+43
+50
+])
+AT_CHECK([mbox2dir -m -i names inbox $spooldir/mbox1])
+AT_CHECK([
+mbop -m inbox 1 \; uid \; 2 \; uid \; 3 \; uid \; 4 \; uid \; 5 \; uid
+],
+[0],
+[1 current message
+1 uid: 1
+2 current message
+2 uid: 20
+3 current message
+3 uid: 22
+4 current message
+4 uid: 43
+5 current message
+5 uid: 50
+])
+AT_CLEANUP
+
+
diff --git a/libproto/mh/tests/uidvalidity.at b/libproto/mh/tests/uidvalidity.at
new file mode 100644
index 000000000..dd49556b6
--- /dev/null
+++ b/libproto/mh/tests/uidvalidity.at
@@ -0,0 +1,35 @@
+# GNU Mailutils -- a suite of utilities for electronic mail -*- autotest -*-
+# Copyright (C) 2020 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/>.
+
+AT_SETUP([uidvalidity])
+AT_DATA([names],
+[1
+20
+22
+43
+50
+])
+AT_CHECK([mbox2dir -m -i names -p -v 10 inbox $spooldir/mbox1])
+AT_CHECK([
+mbop -m inbox uidvalidity \; uidnext
+],
+[0],
+[uidvalidity: 10
+uidnext: 51
+])
+AT_CLEANUP
+
+

Return to:

Send suggestions and report system problems to the System administrator.