summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-12-16 16:36:29 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2011-12-16 20:58:59 +0200
commit33a5d85239028bc3e34eec59909253d12d5434f4 (patch)
tree5bd640ccf3988c2a616d7c44575c9be35e02f16f /testsuite
parenta837453677a2888155aa565666acc956cdd3f896 (diff)
downloadmailutils-33a5d85239028bc3e34eec59909253d12d5434f4.tar.gz
mailutils-33a5d85239028bc3e34eec59909253d12d5434f4.tar.bz2
Share folder implementation between mbox, mh and maildir. Fix mu_folder_delete.
* include/mailutils/folder.h (_mu_fsfolder_init): New proto. * include/mailutils/mailbox.h (mu_mailbox_create_at): New proto. * libmailutils/mailbox/mailbox.c (mu_mailbox_create_at): New function. * libmailutils/mailbox/Makefile.am (libmailbox_la_SOURCES): Add fsfolder.c * libmailutils/mailbox/folder.c (mu_folder_delete): If folder does not provide its own method for deletion, use mu_mailbox_remove. (mu_folder_open, mu_folder_close, mu_folder_enumerate) (mu_folder_lsub, mu_folder_subscribe, mu_folder_unsubscribe) (mu_folder_rename): Return EINVAL if folder is NULL. (mu_folder_match): Bugfix: don't pass folder flags to fnmatch. * libmailutils/mailbox/fsfolder.c: New file. Implementation of file-system based folders. * libmailutils/mailbox/mailbox (_create_mailbox0): Propagate error return from mu_registrar_lookup_url. * libmailutils/tests/fsfolder00.at: New test case. * libmailutils/tests/fsfolder01.at: New test case. * libmailutils/tests/fsfolder02.at: New test case. * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add fsfolder. (TESTSUITE_AT): Add fsfolder tests. * libmailutils/tests/testsuite.at: Include fsfolder tests. * libproto/mbox/folder.c: Use fsfolder. (_mh_is_scheme): Check file even if scheme matches. * libproto/maildir/folder.c: Likewise. (_maildir_is_scheme): Check file even if scheme matches. * libproto/mh/folder.c: Likewise. * testsuite/fldel.c: New file. * testsuite/Makefile.am (noinst_PROGRAMS): Buld fldel.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/.gitignore1
-rw-r--r--testsuite/Makefile.am1
-rw-r--r--testsuite/fldel.c54
3 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 9db984b29..29a922189 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1,5 +1,6 @@
atconfig
atlocal
+fldel
package.m4
testsuite
testsuite.dir
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 17079857e..e113ec8da 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 = \
+ fldel\
lstuid\
mbdel\
mimetest\
diff --git a/testsuite/fldel.c b/testsuite/fldel.c
new file mode 100644
index 000000000..206f6b60a
--- /dev/null
+++ b/testsuite/fldel.c
@@ -0,0 +1,54 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2010, 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)
+{
+ int rc;
+ mu_folder_t f;
+
+ if (argc != 3)
+ {
+ fprintf (stderr, "usage: %s URL NAME\n", argv[0]);
+ return 1;
+ }
+
+ mu_register_all_mbox_formats ();
+
+ MU_ASSERT (mu_folder_create (&f, argv[1]));
+ rc = mu_folder_delete (f, argv[2]);
+ if (rc)
+ {
+ if (rc == ENOTEMPTY)
+ {
+ printf ("mailbox removed, but has subfolders\n");
+ rc = 0;
+ }
+ else
+ fprintf (stderr, "%s\n", mu_strerror (rc));
+ }
+ mu_folder_destroy (&f);
+
+ return rc != 0;
+}

Return to:

Send suggestions and report system problems to the System administrator.