aboutsummaryrefslogtreecommitdiffstats
path: root/camel/tests
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-06-12 22:29:28 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-06-12 22:29:28 +0800
commitf14e85f771600855dedae6d29301d656ea86185b (patch)
tree2a2dd4e515e0398c3f737c800c966f55acae6a38 /camel/tests
parent8131304fd121b4c3b4df98a17b3a376c1bffaada (diff)
downloadgsoc2013-evolution-f14e85f771600855dedae6d29301d656ea86185b.tar.gz
gsoc2013-evolution-f14e85f771600855dedae6d29301d656ea86185b.tar.zst
gsoc2013-evolution-f14e85f771600855dedae6d29301d656ea86185b.zip
A new provider, for spool mailboxes. Mostly a cut and paste of the mbox
2001-06-12 Not Zed <NotZed@Ximian.com> * providers/local/camel-spool-*.[ch]: A new provider, for spool mailboxes. Mostly a cut and paste of the mbox code, but not a subclass CamelLocal*. Not tested a lot, doesn't lock yet, use with extreme caution. * tests/lib/folders.c (test_folder_message_ops): Added spool arg, spool folders can't be deleted, renamed, etc. (test_folder_basic): Same. * tests/folder/test2.c (main): Added checks for spool type. * tests/[message|stream|folder|misc|smime]/Makefile.am (LDADD): Added db3 flags, so make check compiles, doesn't run though. 2001-05-24 Not Zed <NotZed@Ximian.com> * providers/local/camel-local-provider.c (camel_provider_module_init): Added spool provider. svn path=/trunk/; revision=10198
Diffstat (limited to 'camel/tests')
-rw-r--r--camel/tests/folder/Makefile.am1
-rw-r--r--camel/tests/folder/test1.c2
-rw-r--r--camel/tests/folder/test2.c10
-rw-r--r--camel/tests/folder/test4.c2
-rw-r--r--camel/tests/folder/test5.c2
-rw-r--r--camel/tests/lib/folders.c92
-rw-r--r--camel/tests/lib/folders.h4
-rw-r--r--camel/tests/message/Makefile.am2
-rw-r--r--camel/tests/misc/Makefile.am1
-rw-r--r--camel/tests/smime/Makefile.am1
-rw-r--r--camel/tests/stream/Makefile.am1
11 files changed, 69 insertions, 49 deletions
diff --git a/camel/tests/folder/Makefile.am b/camel/tests/folder/Makefile.am
index f6dd852dd8..1b3e3338ec 100644
--- a/camel/tests/folder/Makefile.am
+++ b/camel/tests/folder/Makefile.am
@@ -8,6 +8,7 @@ LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libibex/libibex.la \
+ $(DB3_LDADD) \
$(GNOME_LIBDIR) \
$(top_builddir)/camel/tests/lib/libcameltest.a \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
diff --git a/camel/tests/folder/test1.c b/camel/tests/folder/test1.c
index 4d589099f5..c1d3809852 100644
--- a/camel/tests/folder/test1.c
+++ b/camel/tests/folder/test1.c
@@ -38,7 +38,7 @@ int main(int argc, char **argv)
for (i=0;i<ARRAY_LEN(local_providers);i++) {
path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[i], local_providers[i]);
- test_folder_basic(session, path, TRUE);
+ test_folder_basic(session, path, TRUE, FALSE);
g_free(path);
}
diff --git a/camel/tests/folder/test2.c b/camel/tests/folder/test2.c
index 0fafce35be..9ea0efabbb 100644
--- a/camel/tests/folder/test2.c
+++ b/camel/tests/folder/test2.c
@@ -1,5 +1,9 @@
/* folder testing */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include "camel-test.h"
#include "messages.h"
#include "folders.h"
@@ -40,9 +44,13 @@ int main(int argc, char **argv)
for (i=0;i<ARRAY_LEN(stores);i++) {
char *name = stores[i];
- test_folder_message_ops(session, name, TRUE);
+ test_folder_message_ops(session, name, TRUE, FALSE);
}
+ /* create a pseudo-spool file, and check that */
+ creat("/tmp/camel-test/testbox", 0600);
+ test_folder_message_ops(session, "spool:///tmp/camel-test", FALSE, TRUE);
+
check_unref(session, 1);
camel_exception_free(ex);
diff --git a/camel/tests/folder/test4.c b/camel/tests/folder/test4.c
index f6d766f2ac..eb0bd3420b 100644
--- a/camel/tests/folder/test4.c
+++ b/camel/tests/folder/test4.c
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
_exit(77);
}
camel_test_nonfatal("The IMAP code is just rooted");
- test_folder_basic(session, path, FALSE);
+ test_folder_basic(session, path, FALSE, FALSE);
camel_test_fatal();
}
diff --git a/camel/tests/folder/test5.c b/camel/tests/folder/test5.c
index 20e0c7d011..ccdfb23b23 100644
--- a/camel/tests/folder/test5.c
+++ b/camel/tests/folder/test5.c
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
_exit(77);
}
camel_test_nonfatal("Not sure how many tests apply to NNTP");
- test_folder_basic(session, path, FALSE);
+ test_folder_basic(session, path, FALSE, FALSE);
camel_test_fatal();
}
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index 31d242070d..2e9638a25f 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -189,7 +189,7 @@ test_folder_not_message(CamelFolder *folder, const char *uid)
/* test basic store operations on folders */
/* TODO: Add subscription stuff */
void
-test_folder_basic(CamelSession *session, const char *storename, int local)
+test_folder_basic(CamelSession *session, const char *storename, int local, int spool)
{
CamelStore *store;
CamelException *ex = camel_exception_new();
@@ -226,44 +226,46 @@ test_folder_basic(CamelSession *session, const char *storename, int local)
camel_exception_clear(ex);
pull();
- push("getting a non-existant folder, with create");
- folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
- check_unref(folder, 1);
- pull();
+ if (!spool) {
+ push("getting a non-existant folder, with create");
+ folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
+ check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+ check(folder != NULL);
+ check_unref(folder, 1);
+ pull();
- push("getting an existing folder");
- folder = camel_store_get_folder(store, "testbox", 0, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
- check_unref(folder, 1);
- pull();
+ push("getting an existing folder");
+ folder = camel_store_get_folder(store, "testbox", 0, ex);
+ check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+ check(folder != NULL);
+ check_unref(folder, 1);
+ pull();
- push("renaming a non-existant folder");
- camel_store_rename_folder(store, "unknown1", "unknown2", ex);
- check(camel_exception_is_set(ex));
- camel_exception_clear(ex);
- pull();
+ push("renaming a non-existant folder");
+ camel_store_rename_folder(store, "unknown1", "unknown2", ex);
+ check(camel_exception_is_set(ex));
+ camel_exception_clear(ex);
+ pull();
- push("renaming an existing folder");
- camel_store_rename_folder(store, "testbox", "testbox2", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
+ push("renaming an existing folder");
+ camel_store_rename_folder(store, "testbox", "testbox2", ex);
+ check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+ pull();
- push("opening the old name of a renamed folder");
- folder = camel_store_get_folder(store, "testbox", 0, ex);
- check(camel_exception_is_set(ex));
- check(folder == NULL);
- camel_exception_clear(ex);
- pull();
+ push("opening the old name of a renamed folder");
+ folder = camel_store_get_folder(store, "testbox", 0, ex);
+ check(camel_exception_is_set(ex));
+ check(folder == NULL);
+ camel_exception_clear(ex);
+ pull();
- push("opening the new name of a renamed folder");
- folder = camel_store_get_folder(store, "testbox2", 0, ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- check(folder != NULL);
- check_unref(folder, 1);
- pull();
+ push("opening the new name of a renamed folder");
+ folder = camel_store_get_folder(store, "testbox2", 0, ex);
+ check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+ check(folder != NULL);
+ check_unref(folder, 1);
+ pull();
+ }
push("deleting a non-existant folder");
camel_store_delete_folder(store, "unknown", ex);
@@ -271,10 +273,12 @@ test_folder_basic(CamelSession *session, const char *storename, int local)
camel_exception_clear(ex);
pull();
- push("deleting an existing folder");
- camel_store_delete_folder(store, "testbox2", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
+ if (!spool) {
+ push("deleting an existing folder");
+ camel_store_delete_folder(store, "testbox2", ex);
+ check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+ pull();
+ }
push("opening a folder that has been deleted");
folder = camel_store_get_folder(store, "testbox2", 0, ex);
@@ -294,7 +298,7 @@ test_folder_basic(CamelSession *session, const char *storename, int local)
/* todo: cross-check everything with folder_info checks as well */
/* this should probably take a folder instead of a session ... */
void
-test_folder_message_ops(CamelSession *session, const char *name, int local)
+test_folder_message_ops(CamelSession *session, const char *name, int local, int spool)
{
CamelStore *store;
CamelException *ex = camel_exception_new();
@@ -499,10 +503,12 @@ test_folder_message_ops(CamelSession *session, const char *name, int local)
check_unref(folder, 1);
pull(); /* re-opening folder */
- push("deleting test folder, with no messages in it");
- camel_store_delete_folder(store, "testbox", ex);
- check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
- pull();
+ if (!spool) {
+ push("deleting test folder, with no messages in it");
+ camel_store_delete_folder(store, "testbox", ex);
+ check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+ pull();
+ }
check_unref(store, 1);
camel_test_end();
diff --git a/camel/tests/lib/folders.h b/camel/tests/lib/folders.h
index 2cb2d97028..d3c9686dc2 100644
--- a/camel/tests/lib/folders.h
+++ b/camel/tests/lib/folders.h
@@ -15,6 +15,6 @@ void test_folder_message(CamelFolder *folder, const char *uid);
/* check message not present everywhere it shouldn't be */
void test_folder_not_message(CamelFolder *folder, const char *uid);
/* test basic folder ops on a store */
-void test_folder_basic(CamelSession *session, const char *storename, int local);
+void test_folder_basic(CamelSession *session, const char *storename, int local, int spool);
/* test basic message operations on a folder */
-void test_folder_message_ops(CamelSession *session, const char *storename, int local);
+void test_folder_message_ops(CamelSession *session, const char *storename, int local, int spool);
diff --git a/camel/tests/message/Makefile.am b/camel/tests/message/Makefile.am
index aa430fa409..09bce0b0d1 100644
--- a/camel/tests/message/Makefile.am
+++ b/camel/tests/message/Makefile.am
@@ -4,10 +4,12 @@ INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
-I$(top_srcdir)/camel/tests/lib \
-DG_LOG_DOMAIN=\"evolution-tests\"
+# We want to remove the DB3 crap asap.
LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libibex/libibex.la \
+ $(DB3_LDADD) \
$(GNOME_LIBDIR) \
$(top_builddir)/camel/tests/lib/libcameltest.a \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
diff --git a/camel/tests/misc/Makefile.am b/camel/tests/misc/Makefile.am
index 1cbcab8c26..6c50ed63b2 100644
--- a/camel/tests/misc/Makefile.am
+++ b/camel/tests/misc/Makefile.am
@@ -8,6 +8,7 @@ LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libibex/libibex.la \
+ $(DB3_LDADD) \
$(GNOME_LIBDIR) \
$(top_builddir)/camel/tests/lib/libcameltest.a \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
diff --git a/camel/tests/smime/Makefile.am b/camel/tests/smime/Makefile.am
index 4f86852a7c..038a25e51f 100644
--- a/camel/tests/smime/Makefile.am
+++ b/camel/tests/smime/Makefile.am
@@ -8,6 +8,7 @@ LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libibex/libibex.la \
+ $(DB3_LDADD) \
$(GNOME_LIBDIR) \
$(top_builddir)/camel/tests/lib/libcameltest.a \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS) \
diff --git a/camel/tests/stream/Makefile.am b/camel/tests/stream/Makefile.am
index d16f8aaa55..ee32d9723d 100644
--- a/camel/tests/stream/Makefile.am
+++ b/camel/tests/stream/Makefile.am
@@ -8,6 +8,7 @@ LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libibex/libibex.la \
+ $(DB3_LDADD) \
$(GNOME_LIBDIR) \
$(top_builddir)/camel/tests/lib/libcameltest.a \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)