diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/Makefile.am | 4 | ||||
-rw-r--r-- | testsuite/lstuid.c | 54 | ||||
-rw-r--r-- | testsuite/lstuid00.at | 31 | ||||
-rw-r--r-- | testsuite/lstuid01.at | 40 | ||||
-rw-r--r-- | testsuite/lstuid02.at | 40 | ||||
-rw-r--r-- | testsuite/testsuite.at | 3 |
6 files changed, 172 insertions, 0 deletions
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 61144e3e7..17079857e 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -50,6 +50,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac INCLUDES = @MU_LIB_COMMON_INCLUDES@ noinst_PROGRAMS = \ + lstuid\ mbdel\ mimetest\ smtpsend\ @@ -77,6 +78,9 @@ smtpsend_LDADD = \ ## ------------ ## TESTSUITE_AT = \ + lstuid00.at\ + lstuid01.at\ + lstuid02.at\ mbdel.at\ mime.at\ ufms.at\ diff --git a/testsuite/lstuid.c b/testsuite/lstuid.c new file mode 100644 index 000000000..95274cd8f --- /dev/null +++ b/testsuite/lstuid.c @@ -0,0 +1,54 @@ +/* lstuid.c: List UIDs in mailbox + Copyright (C) 2011 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/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <mailutils/mailutils.h> + +int +main (int argc, char **argv) +{ + mu_mailbox_t mbox; + size_t i, count; + mu_message_t msg; + + if (argc != 2) + { + fprintf (stderr, "usage: %s MBOX\n", argv[0]); + return 1; + } + + mu_registrar_record (mu_mbox_record); + + /* Open the mailbox */ + MU_ASSERT (mu_mailbox_create (&mbox, argv[1])); + MU_ASSERT (mu_mailbox_open (mbox, MU_STREAM_RDWR)); + mu_mailbox_messages_count (mbox, &count); + for (i = 1; i <= count; i++) + { + size_t uid; + MU_ASSERT (mu_mailbox_get_message (mbox, i, &msg)); + MU_ASSERT (mu_message_get_uid (msg, &uid)); + printf ("%lu: %lu\n", (unsigned long) i, (unsigned long) uid); + } + mu_mailbox_close (mbox); + mu_mailbox_destroy (&mbox); + return 0; +} diff --git a/testsuite/lstuid00.at b/testsuite/lstuid00.at new file mode 100644 index 000000000..ee3718902 --- /dev/null +++ b/testsuite/lstuid00.at @@ -0,0 +1,31 @@ +# This file is part of GNU Mailutils. -*- Autotest -*- +# Copyright (C) 2011 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/>. + +AT_SETUP([Assigning UIDs]) + +AT_CHECK([ +MUT_MBCOPY($abs_top_srcdir/testsuite/spool/mbox1) +lstuid mbox:mbox1 +], +[0], +[1: 1 +2: 2 +3: 3 +4: 4 +5: 5 +]) + +AT_CLEANUP
\ No newline at end of file diff --git a/testsuite/lstuid01.at b/testsuite/lstuid01.at new file mode 100644 index 000000000..06c13a757 --- /dev/null +++ b/testsuite/lstuid01.at @@ -0,0 +1,40 @@ +# This file is part of GNU Mailutils. -*- Autotest -*- +# Copyright (C) 2011 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/>. + +AT_SETUP([Assigning UIDs (with gaps)]) + +AT_DATA([x-uid.sed], +[/^Subject: Jabberwocky/a\ +X-UID: 2 + +/^Subject: Simple MIME/a\ +X-UID: 10 + +]) + +AT_CHECK([ +sed -f x-uid.sed $abs_top_srcdir/testsuite/spool/mbox1 > mbox1 +lstuid mbox:mbox1 +], +[0], +[1: 2 +2: 3 +3: 10 +4: 11 +5: 12 +]) + +AT_CLEANUP
\ No newline at end of file diff --git a/testsuite/lstuid02.at b/testsuite/lstuid02.at new file mode 100644 index 000000000..42d972962 --- /dev/null +++ b/testsuite/lstuid02.at @@ -0,0 +1,40 @@ +# This file is part of GNU Mailutils. -*- Autotest -*- +# Copyright (C) 2011 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/>. + +AT_SETUP([Assigning UIDs (with fixups)]) + +AT_DATA([x-uid.sed], +[/^Subject: Jabberwocky/a\ +X-UID: 2 + +/^Subject: Simple MIME/a\ +X-UID: 1 + +]) + +AT_CHECK([ +sed -f x-uid.sed $abs_top_srcdir/testsuite/spool/mbox1 > mbox1 +lstuid mbox:mbox1 +], +[0], +[1: 2 +2: 3 +3: 4 +4: 5 +5: 6 +]) + +AT_CLEANUP
\ No newline at end of file diff --git a/testsuite/testsuite.at b/testsuite/testsuite.at index 92e9c5402..48bbe1aa7 100644 --- a/testsuite/testsuite.at +++ b/testsuite/testsuite.at @@ -18,6 +18,9 @@ m4_include([testsuite.inc]) AT_INIT +m4_include([lstuid00.at]) +m4_include([lstuid01.at]) +m4_include([lstuid02.at]) m4_include([mime.at]) m4_include([mbdel.at]) m4_include([ufms.at]) |