[evolution-data-server] Camel: Adapt tests to API changes.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Camel: Adapt tests to API changes.
- Date: Tue, 28 Sep 2010 16:28:18 +0000 (UTC)
commit 3fb46edb4f3530ed4fa1ea5a89cde190245b8212
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Sep 28 11:24:57 2010 -0400
Camel: Adapt tests to API changes.
camel/tests/folder/test10.c | 16 ++-
camel/tests/folder/test11.c | 95 +++++++++------
camel/tests/folder/test3.c | 120 ++++++++++---------
camel/tests/folder/test8.c | 81 +++++++------
camel/tests/folder/test9.c | 66 ++++++-----
camel/tests/lib/address-data.h | 15 ++-
camel/tests/lib/camel-test.c | 3 +-
camel/tests/lib/folders.c | 207 +++++++++++++++++---------------
camel/tests/lib/messages.c | 83 +++++++------
camel/tests/lib/streams.c | 84 ++++++++------
camel/tests/message/test2.c | 2 +-
camel/tests/message/test4.c | 3 +-
camel/tests/mime-filter/test-charset.c | 20 ++--
camel/tests/mime-filter/test-crlf.c | 29 +++--
camel/tests/mime-filter/test-tohtml.c | 8 +-
camel/tests/mime-filter/test1.c | 26 ++--
camel/tests/misc/utf7.c | 21 ++--
camel/tests/smime/pgp.c | 42 ++++---
camel/tests/stream/test1.c | 47 ++++----
19 files changed, 538 insertions(+), 430 deletions(-)
---
diff --git a/camel/tests/folder/test10.c b/camel/tests/folder/test10.c
index 6d06f3e..16448b8 100644
--- a/camel/tests/folder/test10.c
+++ b/camel/tests/folder/test10.c
@@ -11,7 +11,7 @@
#define MAX_LOOP (10000)
#define MAX_THREADS (5)
-#define d(x)
+#define d (x)
static const gchar *local_drivers[] = { "local" };
static const gchar *local_providers[] = {
@@ -33,7 +33,9 @@ worker (gpointer d)
for (i=0;i<MAX_LOOP;i++) {
store = camel_session_get_store (session, path, NULL);
- folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, NULL);
+ folder = camel_store_get_folder_sync (
+ store, "testbox",
+ CAMEL_STORE_FOLDER_CREATE, NULL, NULL);
if (testid == 0) {
g_object_unref (folder);
g_object_unref (store);
@@ -56,20 +58,20 @@ main (gint argc, gchar **argv)
camel_test_provider_init (1, local_drivers);
/* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
+ system ("/bin/rm -rf /tmp/camel-test");
session = camel_test_session_new ("/tmp/camel-test");
for (testid=0;testid<2;testid++) {
if (testid == 0)
- camel_test_start("store and folder bag torture test, stacked references");
+ camel_test_start ("store and folder bag torture test, stacked references");
else
- camel_test_start("store and folder bag torture test, unstacked references");
+ camel_test_start ("store and folder bag torture test, unstacked references");
for (j = 0; j < G_N_ELEMENTS (local_providers); j++) {
- camel_test_push("provider %s", local_providers[j]);
- path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]);
+ camel_test_push ("provider %s", local_providers[j]);
+ path = g_strdup_printf ("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]);
for (i = 0; i < MAX_THREADS; i++) {
GError *error = NULL;
diff --git a/camel/tests/folder/test11.c b/camel/tests/folder/test11.c
index f4efaec..b23ee28 100644
--- a/camel/tests/folder/test11.c
+++ b/camel/tests/folder/test11.c
@@ -10,8 +10,6 @@
#define MAX_LOOP (10000)
#define MAX_THREADS (5)
-#define d(x)
-
static const gchar *local_drivers[] = { "local" };
static CamelSession *session;
@@ -67,22 +65,22 @@ check_fi (CamelFolderInfo *fi, CamelFolderInfo *list, gint len)
gint i;
add_fi (folders, fi);
- check_msg(folders->len == len, "unexpected number of folders returned from folderinfo");
+ check_msg (folders->len == len, "unexpected number of folders returned from folderinfo");
qsort (folders->pdata, folders->len, sizeof (folders->pdata[0]), cmp_fi);
for (i=0;i<len;i++) {
CamelFolderInfo *f = folders->pdata[i];
- camel_test_push("checking folder '%s'", list[i].uri);
+ camel_test_push ("checking folder '%s'", list[i].uri);
- check_msg(!strcmp(f->uri, list[i].uri), "got '%s' expecting '%s'", f->uri, list[i].uri);
+ check_msg (!strcmp (f->uri, list[i].uri), "got '%s' expecting '%s'", f->uri, list[i].uri);
check (!strcmp (f->full_name, list[i].full_name));
/* this might be translated, but we can't know */
- camel_test_nonfatal("Inbox not english");
+ camel_test_nonfatal ("Inbox not english");
check (!strcmp (f->name, list[i].name));
camel_test_fatal ();
- camel_test_nonfatal("Flags mismatch");
+ camel_test_nonfatal ("Flags mismatch");
check (f->flags == list[i].flags);
camel_test_fatal ();
@@ -104,80 +102,97 @@ main (gint argc, gchar **argv)
camel_test_provider_init (1, local_drivers);
/* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
+ system ("/bin/rm -rf /tmp/camel-test");
- session = camel_test_session_new("/tmp/camel-test");
- store = camel_session_get_store(session, "maildir:///tmp/camel-test/maildir", NULL);
+ session = camel_test_session_new ("/tmp/camel-test");
+ store = camel_session_get_store (session, "maildir:///tmp/camel-test/maildir", NULL);
- camel_test_start("Maildir backward compatability tests");
+ camel_test_start ("Maildir backward compatability tests");
- camel_test_push("./ prefix path, one level");
- f1 = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_test_push ("./ prefix path, one level");
+ f1 = camel_store_get_folder_sync (
+ store, "testbox",
+ CAMEL_STORE_FOLDER_CREATE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
- f2 = camel_store_get_folder(store, "./testbox", CAMEL_STORE_FOLDER_CREATE, &error);
- check_msg(error == NULL, "%s", error->message);
+ f2 = camel_store_get_folder_sync (
+ store, "./testbox",
+ CAMEL_STORE_FOLDER_CREATE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check (f1 == f2);
check_unref (f2, 2);
check_unref (f1, 1);
camel_test_pull ();
- camel_test_push("./ prefix path, one level, no create");
- f1 = camel_store_get_folder(store, "testbox2", CAMEL_STORE_FOLDER_CREATE, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_test_push ("./ prefix path, one level, no create");
+ f1 = camel_store_get_folder_sync (
+ store, "testbox2",
+ CAMEL_STORE_FOLDER_CREATE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
- f2 = camel_store_get_folder(store, "./testbox2", 0, &error);
- check_msg(error == NULL, "%s", error->message);
+ f2 = camel_store_get_folder_sync (
+ store, "./testbox2", 0, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check (f1 == f2);
check_unref (f2, 2);
check_unref (f1, 1);
camel_test_pull ();
- camel_test_push("./ prefix path, two levels");
- f1 = camel_store_get_folder(store, "testbox/foo", CAMEL_STORE_FOLDER_CREATE, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_test_push ("./ prefix path, two levels");
+ f1 = camel_store_get_folder_sync (
+ store, "testbox/foo",
+ CAMEL_STORE_FOLDER_CREATE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
- f2 = camel_store_get_folder(store, "./testbox/foo", CAMEL_STORE_FOLDER_CREATE, &error);
- check_msg(error == NULL, "%s", error->message);
+ f2 = camel_store_get_folder_sync (
+ store, "./testbox/foo",
+ CAMEL_STORE_FOLDER_CREATE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check (f1 == f2);
check_unref (f2, 2);
check_unref (f1, 1);
camel_test_pull ();
- camel_test_push("'.' == Inbox");
- f2 = camel_store_get_inbox (store, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_test_push ("'.' == Inbox");
+ f2 = camel_store_get_inbox_folder_sync (store, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
- f1 = camel_store_get_folder(store, ".", 0, &error);
- check_msg(error == NULL, "%s", error->message);
+ f1 = camel_store_get_folder_sync (store, ".", 0, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check (f1 == f2);
check_unref (f2, 2);
check_unref (f1, 1);
camel_test_pull ();
- camel_test_push("folder info, recursive");
- fi = camel_store_get_folder_info(store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_test_push ("folder info, recursive");
+ fi = camel_store_get_folder_info_sync (
+ store, "",
+ CAMEL_STORE_FOLDER_INFO_RECURSIVE,
+ NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check (fi != NULL);
check_fi (fi, fi_list_1, G_N_ELEMENTS (fi_list_1));
camel_test_pull ();
- camel_test_push("folder info, flat");
- fi = camel_store_get_folder_info(store, "", 0, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_test_push ("folder info, flat");
+ fi = camel_store_get_folder_info_sync (store, "", 0, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check (fi != NULL);
check_fi (fi, fi_list_2, G_N_ELEMENTS (fi_list_2));
camel_test_pull ();
- camel_test_push("folder info, recursive, non root");
- fi = camel_store_get_folder_info(store, "testbox", CAMEL_STORE_FOLDER_INFO_RECURSIVE, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_test_push ("folder info, recursive, non root");
+ fi = camel_store_get_folder_info_sync (
+ store, "testbox",
+ CAMEL_STORE_FOLDER_INFO_RECURSIVE,
+ NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check (fi != NULL);
check_fi (fi, fi_list_3, G_N_ELEMENTS (fi_list_3));
diff --git a/camel/tests/folder/test3.c b/camel/tests/folder/test3.c
index fc30d17..ed41d0d 100644
--- a/camel/tests/folder/test3.c
+++ b/camel/tests/folder/test3.c
@@ -18,8 +18,8 @@ test_folder_search_sub (CamelFolder *folder, const gchar *expr, gint expected)
uids = camel_folder_search_by_expression (folder, expr, &error);
check (uids != NULL);
- check_msg(uids->len == expected, "search %s expected %d got %d", expr, expected, uids->len);
- check_msg(error == NULL, "%s", error->message);
+ check_msg (uids->len == expected, "search %s expected %d got %d", expr, expected, uids->len);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
/* check the uid's are actually unique, too */
@@ -40,15 +40,15 @@ test_folder_search (CamelFolder *folder, const gchar *expr, gint expected)
#if 0
/* FIXME: ??? */
- camel_test_nonfatal("most searches require match-all construct");
- push("Testing search: %s", expr);
+ camel_test_nonfatal ("most searches require match-all construct");
+ push ("Testing search: %s", expr);
test_folder_search_sub (folder, expr, expected);
pull ();
camel_test_fatal ();
#endif
- matchall = g_strdup_printf("(match-all %s)", expr);
- push("Testing search: %s", matchall);
+ matchall = g_strdup_printf ("(match-all %s)", expr);
+ push ("Testing search: %s", matchall);
test_folder_search_sub (folder, matchall, expected);
test_free (matchall);
pull ();
@@ -118,9 +118,9 @@ run_search (CamelFolder *folder, gint m)
else if (m==0)
j = 2;
- push("performing searches, expected %d", m);
+ push ("performing searches, expected %d", m);
for (i = 0; i < G_N_ELEMENTS (searches); i++) {
- push("running search %d: %s", i, searches[i].expr);
+ push ("running search %d: %s", i, searches[i].expr);
test_folder_search (folder, searches[i].expr, searches[i].counts[j]);
pull ();
}
@@ -150,7 +150,7 @@ gint main (gint argc, gchar **argv)
camel_test_provider_init (1, local_drivers);
/* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
+ system ("/bin/rm -rf /tmp/camel-test");
session = camel_test_session_new ("/tmp/camel-test");
@@ -161,26 +161,27 @@ gint main (gint argc, gchar **argv)
for (i = 0; i < G_N_ELEMENTS (stores); i++) {
const gchar *name = stores[i];
for (indexed = 0;indexed<2;indexed++) {
- gchar *what = g_strdup_printf("folder search: %s (%sindexed)", name, indexed?"":"non-");
+ gchar *what = g_strdup_printf ("folder search: %s (%sindexed)", name, indexed?"":"non-");
gint flags;
camel_test_start (what);
test_free (what);
- push("getting store");
+ push ("getting store");
store = camel_session_get_store (session, stores[i], &error);
- check_msg(error == NULL, "getting store: %s", error->message);
+ check_msg (error == NULL, "getting store: %s", error->message);
check (store != NULL);
g_clear_error (&error);
pull ();
- push("creating %sindexed folder", indexed?"":"non-");
+ push ("creating %sindexed folder", indexed?"":"non-");
if (indexed)
flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
else
flags = CAMEL_STORE_FOLDER_CREATE;
- folder = camel_store_get_folder(store, "testbox", flags, &error);
- check_msg(error == NULL, "%s", error->message);
+ folder = camel_store_get_folder_sync (
+ store, "testbox", flags, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
/* we need an empty folder for this to work */
@@ -189,25 +190,26 @@ gint main (gint argc, gchar **argv)
pull ();
/* append a bunch of messages with specific content */
- push("appending 100 test messages");
+ push ("appending 100 test messages");
for (j=0;j<100;j++) {
gchar *content, *subject;
- push("creating test message");
+ push ("creating test message");
msg = test_message_create_simple ();
- content = g_strdup_printf("data%d content\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
+ content = g_strdup_printf ("data%d content\n", j);
+ test_message_set_content_simple ((CamelMimePart *)msg, 0, "text/plain",
content, strlen (content));
test_free (content);
- subject = g_strdup_printf("Test%d message%d subject", j, 100-j);
+ subject = g_strdup_printf ("Test%d message%d subject", j, 100-j);
camel_mime_message_set_subject (msg, subject);
camel_mime_message_set_date (msg, j*60*24, 0);
pull ();
- push("appending simple message %d", j);
- camel_folder_append_message (folder, msg, NULL, NULL, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("appending simple message %d", j);
+ camel_folder_append_message_sync (
+ folder, msg, NULL, NULL, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
@@ -217,47 +219,49 @@ gint main (gint argc, gchar **argv)
}
pull ();
- push("Setting up some flags &c");
+ push ("Setting up some flags &c");
uids = camel_folder_get_uids (folder);
check (uids->len == 100);
for (j=0;j<100;j++) {
gchar *uid = uids->pdata[j];
if ((j/13)*13 == j) {
- camel_folder_set_message_user_flag(folder, uid, "every13", TRUE);
+ camel_folder_set_message_user_flag (folder, uid, "every13", TRUE);
}
if ((j/17)*17 == j) {
- camel_folder_set_message_user_flag(folder, uid, "every17", TRUE);
+ camel_folder_set_message_user_flag (folder, uid, "every17", TRUE);
}
if ((j/7)*7 == j) {
- gchar *tag = g_strdup_printf("7tag%d", j/7);
- camel_folder_set_message_user_tag(folder, uid, "every7", tag);
+ gchar *tag = g_strdup_printf ("7tag%d", j/7);
+ camel_folder_set_message_user_tag (folder, uid, "every7", tag);
test_free (tag);
}
if ((j/11)*11 == j) {
- camel_folder_set_message_user_tag(folder, uid, "every11", "11tag");
+ camel_folder_set_message_user_tag (folder, uid, "every11", "11tag");
}
}
camel_folder_free_uids (folder, uids);
pull ();
- camel_test_nonfatal("Index not guaranteed to be accurate before sync: should be fixed eventually");
- push("Search before sync");
+ camel_test_nonfatal ("Index not guaranteed to be accurate before sync: should be fixed eventually");
+ push ("Search before sync");
run_search (folder, 100);
pull ();
camel_test_fatal ();
- push("syncing folder, searching");
- camel_folder_sync (folder, FALSE, NULL);
+ push ("syncing folder, searching");
+ camel_folder_synchronize_sync (
+ folder, FALSE, NULL, NULL);
run_search (folder, 100);
pull ();
- push("syncing wiht expunge, search");
- camel_folder_sync (folder, TRUE, NULL);
+ push ("syncing wiht expunge, search");
+ camel_folder_synchronize_sync (
+ folder, TRUE, NULL, NULL);
run_search (folder, 100);
pull ();
- push("deleting every 2nd message");
+ push ("deleting every 2nd message");
uids = camel_folder_get_uids (folder);
check (uids->len == 100);
for (j=0;j<uids->len;j+=2) {
@@ -266,30 +270,34 @@ gint main (gint argc, gchar **argv)
camel_folder_free_uids (folder, uids);
run_search (folder, 100);
- push("syncing");
- camel_folder_sync (folder, FALSE, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("syncing");
+ camel_folder_synchronize_sync (
+ folder, FALSE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
run_search (folder, 100);
g_clear_error (&error);
pull ();
- push("expunging");
- camel_folder_expunge (folder, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("expunging");
+ camel_folder_expunge_sync (folder, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
run_search (folder, 50);
g_clear_error (&error);
pull ();
pull ();
- push("closing and re-opening folder");
+ push ("closing and re-opening folder");
check_unref (folder, 1);
- folder = camel_store_get_folder(store, "testbox", flags&~(CAMEL_STORE_FOLDER_CREATE), &error);
- check_msg(error == NULL, "%s", error->message);
+ folder = camel_store_get_folder_sync (
+ store, "testbox",
+ flags & ~(CAMEL_STORE_FOLDER_CREATE),
+ NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
g_clear_error (&error);
- push("deleting remaining messages");
+ push ("deleting remaining messages");
uids = camel_folder_get_uids (folder);
check (uids->len == 50);
for (j=0;j<uids->len;j++) {
@@ -298,16 +306,17 @@ gint main (gint argc, gchar **argv)
camel_folder_free_uids (folder, uids);
run_search (folder, 50);
- push("syncing");
- camel_folder_sync (folder, FALSE, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("syncing");
+ camel_folder_synchronize_sync (
+ folder, FALSE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
run_search (folder, 50);
g_clear_error (&error);
pull ();
- push("expunging");
- camel_folder_expunge (folder, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("expunging");
+ camel_folder_expunge_sync (folder, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
run_search (folder, 0);
g_clear_error (&error);
pull ();
@@ -317,9 +326,10 @@ gint main (gint argc, gchar **argv)
check_unref (folder, 1);
pull ();
- push("deleting test folder, with no messages in it");
- camel_store_delete_folder(store, "testbox", &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("deleting test folder, with no messages in it");
+ camel_store_delete_folder_sync (
+ store, "testbox", NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
diff --git a/camel/tests/folder/test8.c b/camel/tests/folder/test8.c
index 82c59c7..f3bc4e0 100644
--- a/camel/tests/folder/test8.c
+++ b/camel/tests/folder/test8.c
@@ -11,8 +11,6 @@
#define MAX_MESSAGES (100)
#define MAX_THREADS (10)
-#define d(x)
-
static const gchar *local_drivers[] = { "local" };
static const gchar *local_providers[] = {
@@ -29,19 +27,20 @@ test_add_message (CamelFolder *folder, gint j)
gchar *subject;
GError *error = NULL;
- push("creating message %d\n", j);
+ push ("creating message %d\n", j);
msg = test_message_create_simple ();
- content = g_strdup_printf("Test message %08x contents\n\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
+ content = g_strdup_printf ("Test message %08x contents\n\n", j);
+ test_message_set_content_simple ((CamelMimePart *)msg, 0, "text/plain",
content, strlen (content));
test_free (content);
- subject = g_strdup_printf("Test message %08x subject", j);
+ subject = g_strdup_printf ("Test message %08x subject", j);
camel_mime_message_set_subject (msg, subject);
pull ();
- push("appending simple message %d", j);
- camel_folder_append_message (folder, msg, NULL, NULL, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("appending simple message %d", j);
+ camel_folder_append_message_sync (
+ folder, msg, NULL, NULL, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
@@ -66,31 +65,31 @@ worker (gpointer d)
/* we add a message, search for it, twiddle some flags, delete it */
/* and flat out */
for (i=0;i<MAX_MESSAGES;i++) {
- d(printf ("Thread %p message %i\n", g_thread_self (), i));
test_add_message (info->folder, id+i);
- sub = g_strdup_printf("(match-all (header-contains \"subject\" \"message %08x subject\"))", id+i);
+ sub = g_strdup_printf ("(match-all (header-contains \"subject\" \"message %08x subject\"))", id+i);
- push("searching for message %d\n\tusing: %s", id+i, sub);
+ push ("searching for message %d\n\tusing: %s", id+i, sub);
res = camel_folder_search_by_expression (info->folder, sub, &error);
- check_msg(error == NULL, "%s", error->message);
- check_msg(res->len == 1, "res->len = %d", res->len);
+ check_msg (error == NULL, "%s", error->message);
+ check_msg (res->len == 1, "res->len = %d", res->len);
g_clear_error (&error);
pull ();
- push("getting message '%s'", res->pdata[0]);
- msg = camel_folder_get_message (info->folder, (gchar *)res->pdata[0], &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("getting message '%s'", res->pdata[0]);
+ msg = camel_folder_get_message_sync (
+ info->folder, (gchar *)res->pdata[0], NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
- content = g_strdup_printf("Test message %08x contents\n\n", id+i);
- push("comparing content '%s': '%s'", res->pdata[0], content);
+ content = g_strdup_printf ("Test message %08x contents\n\n", id+i);
+ push ("comparing content '%s': '%s'", res->pdata[0], content);
test_message_compare_content (camel_medium_get_content ((CamelMedium *)msg), content, strlen (content));
test_free (content);
pull ();
- push("deleting message, cleanup");
+ push ("deleting message, cleanup");
j=(100.0*rand ()/(RAND_MAX+1.0));
if (j<=70) {
camel_folder_delete_message (info->folder, res->pdata[0]);
@@ -106,10 +105,9 @@ worker (gpointer d)
/* about 1-in 100 calls will expunge */
j=(200.0*rand ()/(RAND_MAX+1.0));
if (j<=2) {
- d(printf("Forcing an expuge\n"));
- push("expunging folder");
- camel_folder_expunge (info->folder, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("expunging folder");
+ camel_folder_expunge_sync (info->folder, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
pull ();
}
}
@@ -133,29 +131,35 @@ gint main (gint argc, gchar **argv)
camel_test_provider_init (1, local_drivers);
/* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
+ system ("/bin/rm -rf /tmp/camel-test");
session = camel_test_session_new ("/tmp/camel-test");
for (j = 0; j < G_N_ELEMENTS (local_providers); j++) {
for (index=0;index<2;index++) {
- path = g_strdup_printf("method %s %s", local_providers[j], index?"indexed":"nonindexed");
+ path = g_strdup_printf ("method %s %s", local_providers[j], index?"indexed":"nonindexed");
camel_test_start (path);
test_free (path);
- push("trying %s index %d", local_providers[j], index);
- path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]);
+ push ("trying %s index %d", local_providers[j], index);
+ path = g_strdup_printf ("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]);
store = camel_session_get_store (session, path, &error);
- check_msg(error == NULL, "%s", error->message);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
test_free (path);
if (index == 0)
- folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
+ folder = camel_store_get_folder_sync (
+ store, "testbox",
+ CAMEL_STORE_FOLDER_CREATE,
+ NULL, &error);
else
- folder = camel_store_get_folder(store, "testbox",
- CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, &error);
- check_msg(error == NULL, "%s", error->message);
+ folder = camel_store_get_folder_sync (
+ store, "testbox",
+ CAMEL_STORE_FOLDER_CREATE |
+ CAMEL_STORE_FOLDER_BODY_INDEX,
+ NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
for (i = 0; i < MAX_THREADS; i++) {
@@ -180,20 +184,21 @@ gint main (gint argc, gchar **argv)
}
pull ();
- push("deleting remaining messages");
+ push ("deleting remaining messages");
uids = camel_folder_get_uids (folder);
for (i=0;i<uids->len;i++) {
camel_folder_delete_message (folder, uids->pdata[i]);
}
camel_folder_free_uids (folder, uids);
- camel_folder_expunge (folder, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_folder_expunge_sync (folder, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check_unref (folder, 1);
- camel_store_delete_folder(store, "testbox", &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_store_delete_folder_sync (
+ store, "testbox", NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
check_unref (store, 1);
diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c
index dd7f275..f077a3f 100644
--- a/camel/tests/folder/test9.c
+++ b/camel/tests/folder/test9.c
@@ -95,27 +95,29 @@ gint main (gint argc, gchar **argv)
camel_test_provider_init (1, local_drivers);
/* clear out any camel-test data */
- system("/bin/rm -rf /tmp/camel-test");
+ system ("/bin/rm -rf /tmp/camel-test");
- camel_test_start("Simple filtering of mbox");
+ camel_test_start ("Simple filtering of mbox");
session = camel_test_session_new ("/tmp/camel-test");
/* todo: cross-check everything with folder_info checks as well */
/* todo: work out how to do imap/pop/nntp tests */
- push("getting store");
- store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", &error);
- check_msg(error == NULL, "getting store: %s", error->message);
+ push ("getting store");
+ store = camel_session_get_store (session, "mbox:///tmp/camel-test/mbox", &error);
+ check_msg (error == NULL, "getting store: %s", error->message);
check (store != NULL);
g_clear_error (&error);
pull ();
- push("Creating output folders");
+ push ("Creating output folders");
for (i = 0; i < G_N_ELEMENTS (mailboxes); i++) {
- push("creating %s", mailboxes[i].name);
- mailboxes[i].folder = folder = camel_store_get_folder (store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("creating %s", mailboxes[i].name);
+ mailboxes[i].folder = folder = camel_store_get_folder_sync (
+ store, mailboxes[i].name,
+ CAMEL_STORE_FOLDER_CREATE, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
/* we need an empty folder for this to work */
@@ -126,29 +128,30 @@ gint main (gint argc, gchar **argv)
pull ();
/* append a bunch of messages with specific content */
- push("creating 100 test message mbox");
- mbox = camel_stream_fs_new_with_name("/tmp/camel-test/inbox", O_WRONLY|O_CREAT|O_EXCL, 0600, NULL);
+ push ("creating 100 test message mbox");
+ mbox = camel_stream_fs_new_with_name ("/tmp/camel-test/inbox", O_WRONLY|O_CREAT|O_EXCL, 0600, NULL);
for (j=0;j<100;j++) {
gchar *content, *subject;
- push("creating test message");
+ push ("creating test message");
msg = test_message_create_simple ();
- content = g_strdup_printf("data%d content\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
+ content = g_strdup_printf ("data%d content\n", j);
+ test_message_set_content_simple ((CamelMimePart *)msg, 0, "text/plain",
content, strlen (content));
test_free (content);
- subject = g_strdup_printf("Test%d message%d subject", j, 100-j);
+ subject = g_strdup_printf ("Test%d message%d subject", j, 100-j);
camel_mime_message_set_subject (msg, subject);
camel_mime_message_set_date (msg, j*60*24, 0);
pull ();
- camel_stream_printf(mbox, "From \n");
- check (camel_data_wrapper_write_to_stream ((CamelDataWrapper *)msg, mbox, NULL) != -1);
+ camel_stream_printf (mbox, "From \n");
+ check (camel_data_wrapper_write_to_stream_sync (
+ CAMEL_DATA_WRAPPER (msg), mbox, NULL, NULL) != -1);
#if 0
- push("appending simple message %d", j);
+ push ("appending simple message %d", j);
camel_folder_append_message (folder, msg, NULL, ex);
- check_msg(error == NULL, "%s", error->message);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
#endif
@@ -156,11 +159,11 @@ gint main (gint argc, gchar **argv)
check_unref (msg, 1);
}
- check (camel_stream_close (mbox, NULL) != -1);
+ check (camel_stream_close (mbox, NULL, NULL) != -1);
check_unref (mbox, 1);
pull ();
- push("Building filters");
+ push ("Building filters");
driver = camel_filter_driver_new (session);
camel_filter_driver_set_folder_func (driver, get_folder, NULL);
for (i = 0; i < G_N_ELEMENTS (rules); i++) {
@@ -168,10 +171,11 @@ gint main (gint argc, gchar **argv)
}
pull ();
- push("Executing filters");
+ push ("Executing filters");
camel_filter_driver_set_default_folder (driver, mailboxes[0].folder);
- camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_filter_driver_filter_mbox (
+ driver, "/tmp/camel-test/inbox", NULL, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
/* now need to check the folder counts/etc */
@@ -180,13 +184,14 @@ gint main (gint argc, gchar **argv)
pull ();
/* this tests that invalid rules are caught */
- push("Testing broken match rules");
+ push ("Testing broken match rules");
for (i = 0; i < G_N_ELEMENTS (brokens); i++) {
- push("rule %s", brokens[i].match);
+ push ("rule %s", brokens[i].match);
driver = camel_filter_driver_new (session);
camel_filter_driver_set_folder_func (driver, get_folder, NULL);
camel_filter_driver_add_rule (driver, brokens[i].name, brokens[i].match, brokens[i].action);
- camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+ camel_filter_driver_filter_mbox (
+ driver, "/tmp/camel-test/inbox", NULL, NULL, &error);
check (error != NULL);
check_unref (driver, 1);
g_clear_error (&error);
@@ -194,13 +199,14 @@ gint main (gint argc, gchar **argv)
}
pull ();
- push("Testing broken action rules");
+ push ("Testing broken action rules");
for (i = 0; i < G_N_ELEMENTS (brokena); i++) {
- push("rule %s", brokena[i].action);
+ push ("rule %s", brokena[i].action);
driver = camel_filter_driver_new (session);
camel_filter_driver_set_folder_func (driver, get_folder, NULL);
camel_filter_driver_add_rule (driver, brokena[i].name, brokena[i].match, brokena[i].action);
- camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+ camel_filter_driver_filter_mbox (
+ driver, "/tmp/camel-test/inbox", NULL, NULL, &error);
check (error != NULL);
check_unref (driver, 1);
g_clear_error (&error);
diff --git a/camel/tests/lib/address-data.h b/camel/tests/lib/address-data.h
index e9e3309..dcc4b86 100644
--- a/camel/tests/lib/address-data.h
+++ b/camel/tests/lib/address-data.h
@@ -5,10 +5,13 @@
static struct _a {
gint count;
- gchar *addr;
- gchar *utf8; /* the utf8 in this table was generated by camel itself. As a result i'm making the assumption it
- was right when it was created. It also depends on the format of ::format (),. which is likely to
- change, to handle other bugs !*/
+ const gchar *addr;
+ const gchar *utf8; /* The utf8 in this table was generated by
+ * Camel itself. As a result I'm making the
+ * assumption it was right when it was created.
+ * It also depends on the format of ::format (),
+ * which is likely to change, to handle other
+ * bugs!*/
} test_address[] = {
{ 1, "\"=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?=\" <david iiia csic es>", "David Gutiérrez Magallanes <david iiia csic es>" },
{ 1, "\"=?iso-8859-1?Q?Jos=E9?= Antonio Milke G.\" <gerencia ovoplus com>", "José Antonio Milke G. <gerencia ovoplus com>" },
@@ -50,8 +53,8 @@ static struct _a {
};
static struct _l {
- gchar *type;
- gchar *line;
+ const gchar *type;
+ const gchar *line;
} test_lines[] = {
/* commented out unsupported charsets - FIXME: camel should somehow handle this, although it can't really of course */
/*{ "windows-1251", "Åäèí àïëåò íå îòãîâàðÿ íà çàÿâêà çà çàïèñ.\nÄà ãî ïðåìàõíà ëè èëè äà ïî÷àêàì?" },*/
diff --git a/camel/tests/lib/camel-test.c b/camel/tests/lib/camel-test.c
index 3b90f3a..fe026c4 100644
--- a/camel/tests/lib/camel-test.c
+++ b/camel/tests/lib/camel-test.c
@@ -55,7 +55,8 @@ dump_action (GThread *thread, struct _state *s, gpointer d)
printf("\tTest: %s\n", s->test);
}
-static void die (gint sig)
+static void G_GNUC_NORETURN
+die (gint sig)
{
static gint indie = 0;
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index 9a5f8fb..15e8919 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -10,10 +10,9 @@ test_folder_counts (CamelFolder *folder, gint total, gint unread)
{
GPtrArray *s;
gint i, myunread;
- gint gettotal, getunread;
CamelMessageInfo *info;
- push("test folder counts %d total %d unread", total, unread);
+ push ("test folder counts %d total %d unread", total, unread);
/* use the summary */
s = camel_folder_get_summary (folder);
@@ -61,14 +60,14 @@ void
test_message_info (CamelMimeMessage *msg, const CamelMessageInfo *info)
{
check_msg (safe_strcmp (camel_message_info_subject (info), camel_mime_message_get_subject (msg)) == 0,
- "info->subject = '%s', get_subject() = '%s'", camel_message_info_subject(info), camel_mime_message_get_subject(msg));
+ "info->subject = '%s', get_subject () = '%s'", camel_message_info_subject (info), camel_mime_message_get_subject (msg));
/* FIXME: testing from/cc/to, etc is more tricky */
check (camel_message_info_date_sent (info) == camel_mime_message_get_date (msg, NULL));
/* date received isn't set for messages that haven't been sent anywhere ... */
- /*check(info->date_received == camel_mime_message_get_date_received(msg, NULL));*/
+ /*check (info->date_received == camel_mime_message_get_date_received (msg, NULL));*/
/* so is messageid/references, etc */
}
@@ -84,7 +83,7 @@ test_folder_message (CamelFolder *folder, const gchar *uid)
gint found;
GError *error = NULL;
- push("uid %s is in folder", uid);
+ push ("uid %s is in folder", uid);
/* first try getting info */
info = camel_folder_get_message_info (folder, uid);
@@ -93,8 +92,8 @@ test_folder_message (CamelFolder *folder, const gchar *uid)
camel_folder_free_message_info (folder, info);
/* then, getting message */
- msg = camel_folder_get_message (folder, uid, &error);
- check_msg(error == NULL, "%s", error->message);
+ msg = camel_folder_get_message_sync (folder, uid, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (msg != NULL);
/* cross check with info */
@@ -141,24 +140,24 @@ test_folder_not_message (CamelFolder *folder, const gchar *uid)
gint found;
GError *error = NULL;
- push("uid '%s' is not in folder", uid);
+ push ("uid '%s' is not in folder", uid);
/* first try getting info */
- push("no message info");
+ push ("no message info");
info = camel_folder_get_message_info (folder, uid);
check (info == NULL);
pull ();
/* then, getting message */
- push("no message");
- msg = camel_folder_get_message (folder, uid, &error);
+ push ("no message");
+ msg = camel_folder_get_message_sync (folder, uid, NULL, &error);
check (error != NULL);
check (msg == NULL);
g_clear_error (&error);
pull ();
/* see if it is not in the summary (only once) */
- push("not in summary list");
+ push ("not in summary list");
s = camel_folder_get_summary (folder);
check (s != NULL);
found = 0;
@@ -172,7 +171,7 @@ test_folder_not_message (CamelFolder *folder, const gchar *uid)
pull ();
/* check it is not in the uid list */
- push("not in uid list");
+ push ("not in uid list");
s = camel_folder_get_uids (folder);
check (s != NULL);
found = 0;
@@ -196,22 +195,22 @@ test_folder_basic (CamelSession *session, const gchar *storename, gint local, gi
{
CamelStore *store;
CamelFolder *folder;
- gchar *what = g_strdup_printf("testing store: %s", storename);
+ gchar *what = g_strdup_printf ("testing store: %s", storename);
GError *error = NULL;
camel_test_start (what);
test_free (what);
- push("getting store");
+ push ("getting store");
store = camel_session_get_store (session, storename, &error);
- check_msg(error == NULL, "getting store: %s", error->message);
+ check_msg (error == NULL, "getting store: %s", error->message);
check (store != NULL);
g_clear_error (&error);
pull ();
/* local providers == no inbox */
- push("getting inbox folder");
- folder = camel_store_get_inbox (store, &error);
+ push ("getting inbox folder");
+ folder = camel_store_get_inbox_folder_sync (store, NULL, &error);
if (local) {
/* Well, maildir can have an inbox */
if (folder) {
@@ -221,24 +220,27 @@ test_folder_basic (CamelSession *session, const gchar *storename, gint local, gi
check (error != NULL);
}
} else {
- check_msg(error == NULL, "%s", error->message);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
check_unref (folder, 2);
}
g_clear_error (&error);
pull ();
- push("getting a non-existant folder, no create");
- folder = camel_store_get_folder(store, "unknown", 0, &error);
+ push ("getting a non-existant folder, no create");
+ folder = camel_store_get_folder_sync (
+ store, "unknown", 0, NULL, &error);
check (error != NULL);
check (folder == NULL);
g_clear_error (&error);
pull ();
if (!spool) {
- push("getting a non-existant folder, with create");
- folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("getting a non-existant folder, with create");
+ folder = camel_store_get_folder_sync (
+ store, "testbox", CAMEL_STORE_FOLDER_CREATE,
+ NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
if (local)
check_unref (folder, 1);
@@ -247,9 +249,10 @@ test_folder_basic (CamelSession *session, const gchar *storename, gint local, gi
g_clear_error (&error);
pull ();
- push("getting an existing folder");
- folder = camel_store_get_folder(store, "testbox", 0, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("getting an existing folder");
+ folder = camel_store_get_folder_sync (
+ store, "testbox", 0, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
if (local)
check_unref (folder, 1);
@@ -258,28 +261,32 @@ test_folder_basic (CamelSession *session, const gchar *storename, gint local, gi
g_clear_error (&error);
pull ();
- push("renaming a non-existant folder");
- camel_store_rename_folder(store, "unknown1", "unknown2", &error);
+ push ("renaming a non-existant folder");
+ camel_store_rename_folder_sync (
+ store, "unknown1", "unknown2", NULL, &error);
check (error != NULL);
g_clear_error (&error);
pull ();
- push("renaming an existing folder");
- camel_store_rename_folder(store, "testbox", "testbox2", &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("renaming an existing folder");
+ camel_store_rename_folder_sync (
+ store, "testbox", "testbox2", NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
- push("opening the old name of a renamed folder");
- folder = camel_store_get_folder(store, "testbox", 0, &error);
+ push ("opening the old name of a renamed folder");
+ folder = camel_store_get_folder_sync (
+ store, "testbox", 0, NULL, &error);
check (error != NULL);
check (folder == NULL);
g_clear_error (&error);
pull ();
- push("opening the new name of a renamed folder");
- folder = camel_store_get_folder(store, "testbox2", 0, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("opening the new name of a renamed folder");
+ folder = camel_store_get_folder_sync (
+ store, "testbox2", 0, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
if (local)
check_unref (folder, 1);
@@ -288,22 +295,24 @@ test_folder_basic (CamelSession *session, const gchar *storename, gint local, gi
pull ();
}
- push("deleting a non-existant folder");
- camel_store_delete_folder(store, "unknown", &error);
+ push ("deleting a non-existant folder");
+ camel_store_delete_folder_sync (store, "unknown", NULL, &error);
check (error != NULL);
g_clear_error (&error);
pull ();
if (!spool) {
- push("deleting an existing folder");
- camel_store_delete_folder(store, "testbox2", &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("deleting an existing folder");
+ camel_store_delete_folder_sync (
+ store, "testbox2", NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
}
- push("opening a folder that has been deleted");
- folder = camel_store_get_folder(store, "testbox2", 0, &error);
+ push ("opening a folder that has been deleted");
+ folder = camel_store_get_folder_sync (
+ store, "testbox2", 0, NULL, &error);
check (error != NULL);
check (folder == NULL);
g_clear_error (&error);
@@ -331,78 +340,81 @@ test_folder_message_ops (CamelSession *session, const gchar *name, gint local, c
max=local?2:1;
for (indexed = 0;indexed<max;indexed++) {
- gchar *what = g_strdup_printf("folder ops: %s %s", name, local?(indexed?"indexed":"non-indexed"):"");
+ gchar *what = g_strdup_printf ("folder ops: %s %s", name, local?(indexed?"indexed":"non-indexed"):"");
gint flags;
camel_test_start (what);
test_free (what);
- push("getting store");
+ push ("getting store");
store = camel_session_get_store (session, name, &error);
- check_msg(error == NULL, "getting store: %s", error->message);
+ check_msg (error == NULL, "getting store: %s", error->message);
check (store != NULL);
g_clear_error (&error);
pull ();
- push("creating %sindexed folder", indexed?"":"non-");
+ push ("creating %sindexed folder", indexed?"":"non-");
if (indexed)
flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
else
flags = CAMEL_STORE_FOLDER_CREATE;
- folder = camel_store_get_folder (store, mailbox, flags, &error);
+ folder = camel_store_get_folder_sync (
+ store, mailbox, flags, NULL, &error);
/* we can't create mailbox outside of namespace, since we have no api for it, try
using inbox namespace, works for courier */
if (folder == NULL) {
- gchar *mbox = g_strdup_printf("INBOX/%s", mailbox);
+ gchar *mbox = g_strdup_printf ("INBOX/%s", mailbox);
mailbox = mbox;
g_clear_error (&error);
- folder = camel_store_get_folder (store, mailbox, flags, &error);
+ folder = camel_store_get_folder_sync (
+ store, mailbox, flags, NULL, &error);
}
- check_msg(error == NULL, "%s", error->message);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
/* verify empty/can't get nonexistant stuff */
test_folder_counts (folder, 0, 0);
- test_folder_not_message(folder, "0");
- test_folder_not_message(folder, "");
+ test_folder_not_message (folder, "0");
+ test_folder_not_message (folder, "");
for (j=0;j<10;j++) {
gchar *content, *subject;
- push("creating test message");
+ push ("creating test message");
msg = test_message_create_simple ();
- content = g_strdup_printf("Test message %d contents\n\n", j);
- test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain",
+ content = g_strdup_printf ("Test message %d contents\n\n", j);
+ test_message_set_content_simple ((CamelMimePart *)msg, 0, "text/plain",
content, strlen (content));
test_free (content);
- subject = g_strdup_printf("Test message %d", j);
+ subject = g_strdup_printf ("Test message %d", j);
camel_mime_message_set_subject (msg, subject);
pull ();
- push("appending simple message %d", j);
- camel_folder_append_message (folder, msg, NULL, NULL, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("appending simple message %d", j);
+ camel_folder_append_message_sync (
+ folder, msg, NULL, NULL, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
#if 0
/* sigh, this shouldn't be required, but the imap code is too dumb to do it itself */
if (!local) {
- push("forcing a refresh of folder updates");
+ push ("forcing a refresh of folder updates");
camel_folder_refresh_info (folder, ex);
- check_msg(error == NULL, "%s", error->message);
+ check_msg (error == NULL, "%s", error->message);
pull ();
}
#endif
/*if (!local)
- camel_test_nonfatal("unread counts dont seem right for imap");*/
+ camel_test_nonfatal ("unread counts dont seem right for imap");*/
test_folder_counts (folder, j+1, j+1);
/*if (!local)
camel_test_fatal ();*/
- push("checking it is in the right uid slot & exists");
+ push ("checking it is in the right uid slot & exists");
uids = camel_folder_get_uids (folder);
check (uids != NULL);
check (uids->len == j+1);
@@ -410,12 +422,12 @@ test_folder_message_ops (CamelSession *session, const gchar *name, gint local, c
test_folder_message (folder, uids->pdata[j]);
pull ();
- push("checking it is the right message (subject): %s", subject);
+ push ("checking it is the right message (subject): %s", subject);
if (uids->len > j) {
info = camel_folder_get_message_info (folder, uids->pdata[j]);
check (info != NULL);
check_msg (strcmp (camel_message_info_subject (info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
+ "info->subject %s", camel_message_info_subject (info));
camel_folder_free_message_info (folder, info);
}
camel_folder_free_uids (folder, uids);
@@ -437,16 +449,17 @@ test_folder_message_ops (CamelSession *session, const gchar *name, gint local, c
pull ();
#if 0
- push("deleting test folder, with messages in it");
+ push ("deleting test folder, with messages in it");
camel_store_delete_folder (store, mailbox, ex);
check (camel_exception_is_set (ex));
camel_exception_clear (ex);
pull ();
#endif
- push("re-opening folder");
- folder = camel_store_get_folder (store, mailbox, flags, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("re-opening folder");
+ folder = camel_store_get_folder_sync (
+ store, mailbox, flags, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
check (folder != NULL);
g_clear_error (&error);
@@ -458,24 +471,24 @@ test_folder_message_ops (CamelSession *session, const gchar *name, gint local, c
check (uids != NULL);
check (uids->len == 10);
for (j=0;j<10;j++) {
- gchar *subject = g_strdup_printf("Test message %d", j);
+ gchar *subject = g_strdup_printf ("Test message %d", j);
- push("verify reload of %s", subject);
+ push ("verify reload of %s", subject);
test_folder_message (folder, uids->pdata[j]);
info = camel_folder_get_message_info (folder, uids->pdata[j]);
check_msg (strcmp (camel_message_info_subject (info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
+ "info->subject %s", camel_message_info_subject (info));
test_free (subject);
camel_folder_free_message_info (folder, info);
pull ();
}
- push("deleting first message & expunging");
+ push ("deleting first message & expunging");
camel_folder_delete_message (folder, uids->pdata[0]);
test_folder_counts (folder, 10, 9);
- camel_folder_expunge (folder, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_folder_expunge_sync (folder, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
test_folder_not_message (folder, uids->pdata[0]);
test_folder_counts (folder, 9, 9);
@@ -486,26 +499,26 @@ test_folder_message_ops (CamelSession *session, const gchar *name, gint local, c
check (uids != NULL);
check (uids->len == 9);
for (j=0;j<9;j++) {
- gchar *subject = g_strdup_printf("Test message %d", j+1);
+ gchar *subject = g_strdup_printf ("Test message %d", j+1);
- push("verify after expunge of %s", subject);
+ push ("verify after expunge of %s", subject);
test_folder_message (folder, uids->pdata[j]);
info = camel_folder_get_message_info (folder, uids->pdata[j]);
check_msg (strcmp (camel_message_info_subject (info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
+ "info->subject %s", camel_message_info_subject (info));
test_free (subject);
camel_folder_free_message_info (folder, info);
pull ();
}
pull ();
- push("deleting last message & expunging");
+ push ("deleting last message & expunging");
camel_folder_delete_message (folder, uids->pdata[8]);
/* sync? */
test_folder_counts (folder, 9, 8);
- camel_folder_expunge (folder, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_folder_expunge_sync (folder, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
test_folder_not_message (folder, uids->pdata[8]);
test_folder_counts (folder, 8, 8);
@@ -516,28 +529,28 @@ test_folder_message_ops (CamelSession *session, const gchar *name, gint local, c
check (uids != NULL);
check (uids->len == 8);
for (j=0;j<8;j++) {
- gchar *subject = g_strdup_printf("Test message %d", j+1);
+ gchar *subject = g_strdup_printf ("Test message %d", j+1);
- push("verify after expunge of %s", subject);
+ push ("verify after expunge of %s", subject);
test_folder_message (folder, uids->pdata[j]);
info = camel_folder_get_message_info (folder, uids->pdata[j]);
check_msg (strcmp (camel_message_info_subject (info), subject)==0,
- "info->subject %s", camel_message_info_subject(info));
+ "info->subject %s", camel_message_info_subject (info));
test_free (subject);
camel_folder_free_message_info (folder, info);
pull ();
}
pull ();
- push("deleting all messages & expunging");
+ push ("deleting all messages & expunging");
for (j=0;j<8;j++) {
camel_folder_delete_message (folder, uids->pdata[j]);
}
/* sync? */
test_folder_counts (folder, 8, 0);
- camel_folder_expunge (folder, &error);
- check_msg(error == NULL, "%s", error->message);
+ camel_folder_expunge_sync (folder, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
for (j=0;j<8;j++) {
test_folder_not_message (folder, uids->pdata[j]);
@@ -553,18 +566,20 @@ test_folder_message_ops (CamelSession *session, const gchar *name, gint local, c
check_unref (folder, 2);
pull (); /* re-opening folder */
- if (g_ascii_strcasecmp(mailbox, "INBOX") != 0) {
- push("deleting test folder, with no messages in it");
- camel_store_delete_folder (store, mailbox, &error);
- check_msg(error == NULL, "%s", error->message);
+ if (g_ascii_strcasecmp (mailbox, "INBOX") != 0) {
+ push ("deleting test folder, with no messages in it");
+ camel_store_delete_folder_sync (
+ store, mailbox, NULL, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
}
if (!local) {
- push("disconneect service");
- camel_service_disconnect ((CamelService *)store, TRUE, &error);
- check_msg(error == NULL, "%s", error->message);
+ push ("disconneect service");
+ camel_service_disconnect_sync (
+ CAMEL_SERVICE (store), TRUE, &error);
+ check_msg (error == NULL, "%s", error->message);
g_clear_error (&error);
pull ();
}
diff --git a/camel/tests/lib/messages.c b/camel/tests/lib/messages.c
index 2275501..d6412d3 100644
--- a/camel/tests/lib/messages.c
+++ b/camel/tests/lib/messages.c
@@ -14,18 +14,18 @@ test_message_create_simple (void)
msg = camel_mime_message_new ();
addr = camel_internet_address_new ();
- camel_internet_address_add(addr, "Michael Zucchi", "zed nowhere com");
+ camel_internet_address_add (addr, "Michael Zucchi", "zed nowhere com");
camel_mime_message_set_from (msg, addr);
camel_address_remove ((CamelAddress *)addr, -1);
- camel_internet_address_add(addr, "POSTMASTER", "POSTMASTER somewhere net");
+ camel_internet_address_add (addr, "POSTMASTER", "POSTMASTER somewhere net");
camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_TO, addr);
camel_address_remove ((CamelAddress *)addr, -1);
- camel_internet_address_add(addr, "Michael Zucchi", "zed nowhere com");
+ camel_internet_address_add (addr, "Michael Zucchi", "zed nowhere com");
camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_CC, addr);
check_unref (addr, 1);
- camel_mime_message_set_subject(msg, "Simple message subject");
+ camel_mime_message_set_subject (msg, "Simple message subject");
camel_mime_message_set_date (msg, time (0), 930);
return msg;
@@ -80,7 +80,8 @@ test_message_set_content_simple (CamelMimePart *part, gint how, const gchar *typ
dw = camel_data_wrapper_new ();
camel_data_wrapper_set_mime_type (dw, type);
- camel_data_wrapper_construct_from_stream (dw, (CamelStream *)content, NULL);
+ camel_data_wrapper_construct_from_stream_sync (
+ dw, (CamelStream *)content, NULL, NULL);
camel_medium_set_content ((CamelMedium *)part, dw);
check_unref (content, 2);
@@ -91,15 +92,17 @@ test_message_set_content_simple (CamelMimePart *part, gint how, const gchar *typ
gint
test_message_write_file (CamelMimeMessage *msg, const gchar *name)
{
- CamelStreamFs *file;
+ CamelStream *stream;
gint ret;
- file = (CamelStreamFs *)camel_stream_fs_new_with_name (name, O_CREAT|O_WRONLY, 0600, NULL);
- camel_data_wrapper_write_to_stream ((CamelDataWrapper *)msg, (CamelStream *)file, NULL);
- ret = camel_stream_close ((CamelStream *)file, NULL);
+ stream = camel_stream_fs_new_with_name (
+ name, O_CREAT|O_WRONLY, 0600, NULL);
+ camel_data_wrapper_write_to_stream_sync (
+ CAMEL_DATA_WRAPPER (msg), stream, NULL, NULL);
+ ret = camel_stream_close (stream, NULL, NULL);
- check (G_OBJECT (file)->ref_count == 1);
- g_object_unref (file);
+ check (G_OBJECT (stream)->ref_count == 1);
+ g_object_unref (stream);
return ret;
}
@@ -107,16 +110,17 @@ test_message_write_file (CamelMimeMessage *msg, const gchar *name)
CamelMimeMessage *
test_message_read_file (const gchar *name)
{
- CamelStreamFs *file;
+ CamelStream *stream;
CamelMimeMessage *msg2;
- file = (CamelStreamFs *)camel_stream_fs_new_with_name (name, O_RDONLY, 0, NULL);
+ stream = camel_stream_fs_new_with_name (name, O_RDONLY, 0, NULL);
msg2 = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)msg2, (CamelStream *)file, NULL);
- /* file's refcount may be > 1 if the message is real big */
- check (G_OBJECT (file)->ref_count >=1);
- g_object_unref (file);
+ camel_data_wrapper_construct_from_stream_sync (
+ CAMEL_DATA_WRAPPER (msg2), stream, NULL, NULL);
+ /* stream's refcount may be > 1 if the message is real big */
+ check (G_OBJECT (stream)->ref_count >=1);
+ g_object_unref (stream);
return msg2;
}
@@ -155,7 +159,7 @@ gint
test_message_compare_content (CamelDataWrapper *dw, const gchar *text, gint len)
{
GByteArray *byte_array;
- CamelStream *content;
+ CamelStream *stream;
/* sigh, ok, so i len == 0, dw will probably be 0 too
camel_mime_part_set_content is weird like that */
@@ -163,8 +167,8 @@ test_message_compare_content (CamelDataWrapper *dw, const gchar *text, gint len)
return 0;
byte_array = g_byte_array_new ();
- content = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_decode_to_stream (dw, content, NULL);
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
+ camel_data_wrapper_decode_to_stream_sync (dw, stream, NULL, NULL);
if (byte_array->len != len) {
printf ("original text:\n");
@@ -174,10 +178,10 @@ test_message_compare_content (CamelDataWrapper *dw, const gchar *text, gint len)
hexdump (byte_array->data, byte_array->len);
}
- check_msg(byte_array->len == len, "buffer->len = %d, len = %d", byte_array->len, len);
- check_msg(memcmp(byte_array->data, text, byte_array->len) == 0, "len = %d", len);
+ check_msg (byte_array->len == len, "buffer->len = %d, len = %d", byte_array->len, len);
+ check_msg (memcmp (byte_array->data, text, byte_array->len) == 0, "len = %d", len);
- check_unref (content, 1);
+ check_unref (stream, 1);
return 0;
}
@@ -186,22 +190,29 @@ gint
test_message_compare (CamelMimeMessage *msg)
{
CamelMimeMessage *msg2;
- CamelStream *stream1, *stream2;
+ CamelStream *stream1;
+ CamelStream *stream2;
GByteArray *byte_array1;
GByteArray *byte_array2;
byte_array1 = g_byte_array_new ();
stream1 = camel_stream_mem_new_with_byte_array (byte_array1);
- check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, stream1, NULL) != -1, "write_to_stream 1 failed", NULL);
+ check_msg (camel_data_wrapper_write_to_stream_sync (
+ CAMEL_DATA_WRAPPER (msg), stream1, NULL, NULL) != -1,
+ "write_to_stream 1 failed", NULL);
camel_stream_reset (stream1, NULL);
msg2 = camel_mime_message_new ();
- check_msg(camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg2, (CamelStream *) stream1, NULL) != -1, "construct_from_stream 1 failed");
- camel_stream_reset ((CamelStream *) stream1, NULL);
+ check_msg (camel_data_wrapper_construct_from_stream_sync (
+ CAMEL_DATA_WRAPPER (msg2), stream1, NULL, NULL) != -1,
+ "construct_from_stream 1 failed");
+ camel_stream_reset (stream1, NULL);
byte_array2 = g_byte_array_new ();
stream2 = camel_stream_mem_new_with_byte_array (byte_array2);
- check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg2, stream2, NULL) != -1, "write_to_stream 2 failed");
+ check_msg (camel_data_wrapper_write_to_stream_sync (
+ CAMEL_DATA_WRAPPER (msg2), stream2, NULL, NULL) != -1,
+ "write_to_stream 2 failed");
camel_stream_reset (stream2, NULL);
if (byte_array1->len != byte_array2->len) {
@@ -210,9 +221,9 @@ test_message_compare (CamelMimeMessage *msg)
printf ("stream1 stream:\n%.*s\n", byte_array1->len, byte_array1->data);
printf ("stream2 stream:\n%.*s\n\n", byte_array2->len, byte_array2->data);
- printf("msg1:\n");
+ printf ("msg1:\n");
test_message_dump_structure (msg);
- printf("msg2:\n");
+ printf ("msg2:\n");
test_message_dump_structure (msg2);
content = camel_medium_get_content ((CamelMedium *) msg);
@@ -257,11 +268,11 @@ message_dump_rec (CamelMimeMessage *msg, CamelMimePart *part, gint depth)
s[depth] = 0;
mime_type = camel_data_wrapper_get_mime_type ((CamelDataWrapper *)part);
- printf("%sPart <%s>\n", s, G_OBJECT_TYPE_NAME (part));
- printf("%sContent-Type: %s\n", s, mime_type);
+ printf ("%sPart <%s>\n", s, G_OBJECT_TYPE_NAME (part));
+ printf ("%sContent-Type: %s\n", s, mime_type);
g_free (mime_type);
- printf("%s encoding: %s\n", s, camel_transfer_encoding_to_string(((CamelDataWrapper *)part)->encoding));
- printf("%s part encoding: %s\n", s, camel_transfer_encoding_to_string(camel_mime_part_get_encoding (part)));
+ printf ("%s encoding: %s\n", s, camel_transfer_encoding_to_string (((CamelDataWrapper *)part)->encoding));
+ printf ("%s part encoding: %s\n", s, camel_transfer_encoding_to_string (camel_mime_part_get_encoding (part)));
containee = camel_medium_get_content (CAMEL_MEDIUM (part));
@@ -269,10 +280,10 @@ message_dump_rec (CamelMimeMessage *msg, CamelMimePart *part, gint depth)
return;
mime_type = camel_data_wrapper_get_mime_type (containee);
- printf("%sContent <%s>\n", s, G_OBJECT_TYPE_NAME (containee));
+ printf ("%sContent <%s>\n", s, G_OBJECT_TYPE_NAME (containee));
printf ("%sContent-Type: %s\n", s, mime_type);
g_free (mime_type);
- printf("%s encoding: %s\n", s, camel_transfer_encoding_to_string(((CamelDataWrapper *)containee)->encoding));
+ printf ("%s encoding: %s\n", s, camel_transfer_encoding_to_string (((CamelDataWrapper *)containee)->encoding));
/* using the object types is more accurate than using the mime/types */
if (CAMEL_IS_MULTIPART (containee)) {
diff --git a/camel/tests/lib/streams.c b/camel/tests/lib/streams.c
index a81ab2c..61d9377 100644
--- a/camel/tests/lib/streams.c
+++ b/camel/tests/lib/streams.c
@@ -21,30 +21,34 @@ test_stream_seekable_writepart (CamelSeekableStream *s)
goffset end;
gint i;
- push("seekable stream test, writing ");
+ push ("seekable stream test, writing ");
check (camel_seekable_stream_tell (s) == 0);
check (camel_seekable_stream_seek (s, 0, CAMEL_STREAM_SET, NULL) == 0);
check (camel_seekable_stream_tell (s) == 0);
- check(camel_stream_write(CAMEL_STREAM(s), "", 0, NULL) == 0);
+ check (camel_stream_write (CAMEL_STREAM (s), "", 0, NULL, NULL) == 0);
check (camel_seekable_stream_tell (s) == 0);
- check(camel_stream_write(CAMEL_STREAM(s), "\n", 1, NULL) == 1);
+ check (camel_stream_write (CAMEL_STREAM (s), "\n", 1, NULL, NULL) == 1);
check (camel_seekable_stream_tell (s) == 1);
for (i=0;i<10240;i++) {
- check (camel_stream_write (CAMEL_STREAM (s), teststring, sizeof (teststring), NULL) == sizeof (teststring));
+ check (camel_stream_write (
+ CAMEL_STREAM (s), teststring,
+ sizeof (teststring), NULL, NULL)
+ == sizeof (teststring));
check (camel_seekable_stream_tell (s) == 1 + (i+1)*sizeof (teststring));
}
end = 10240*sizeof (teststring)+1;
- check_msg(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END, NULL) == end, "seek =%d end = %d",
+ check_msg (camel_seekable_stream_seek (s, 0, CAMEL_STREAM_END, NULL) == end, "seek =%d end = %d",
camel_seekable_stream_seek (s, 0, CAMEL_STREAM_END, NULL), end);
check (camel_seekable_stream_seek (s, 0, CAMEL_STREAM_END, NULL) == end);
check (camel_seekable_stream_tell (s) == end);
/* need to read 0 first to set eos */
- check (camel_stream_read (CAMEL_STREAM (s), testbuf, 10240, NULL) == 0);
+ check (camel_stream_read (
+ CAMEL_STREAM (s), testbuf, 10240, NULL, NULL) == 0);
check (camel_stream_eos (CAMEL_STREAM (s)));
pull ();
@@ -56,7 +60,7 @@ test_stream_seekable_readpart (CamelSeekableStream *s)
goffset off, new, end;
gint i, j;
- push("seekable stream test, re-reading");
+ push ("seekable stream test, re-reading");
end = 10240*sizeof (teststring)+1;
@@ -83,7 +87,8 @@ test_stream_seekable_readpart (CamelSeekableStream *s)
}
check (camel_seekable_stream_tell (s) == new);
- check (camel_stream_read (CAMEL_STREAM (s), testbuf, i*3, NULL) == i*3);
+ check (camel_stream_read (
+ CAMEL_STREAM (s), testbuf, i*3, NULL, NULL) == i*3);
for (j=0;j<i*3;j++) {
gint k = new + j;
@@ -100,10 +105,12 @@ test_stream_seekable_readpart (CamelSeekableStream *s)
check (camel_seekable_stream_seek (s, -1, CAMEL_STREAM_END, NULL) == end-1);
check (camel_seekable_stream_tell (s) == end-1);
- check (camel_stream_read (CAMEL_STREAM (s), testbuf, 10240, NULL) == 1);
+ check (camel_stream_read (
+ CAMEL_STREAM (s), testbuf, 10240, NULL, NULL) == 1);
check (testbuf[0] == teststring[sizeof (teststring)-1]);
- check (camel_stream_read (CAMEL_STREAM (s), testbuf, 10240, NULL) == 0);
+ check (camel_stream_read (
+ CAMEL_STREAM (s), testbuf, 10240, NULL, NULL) == 0);
check (camel_seekable_stream_seek (s, 0, CAMEL_STREAM_CUR, NULL) == end);
check (camel_seekable_stream_tell (s) == end);
check (camel_stream_eos (CAMEL_STREAM (s)));
@@ -123,7 +130,7 @@ test_seekable_substream_writepart (CamelStream *s, gint type)
CamelSeekableStream *sp = sus->parent_stream;
gint i, len;
- push("writing substream, type %d", type);
+ push ("writing substream, type %d", type);
if (type == 1) {
check (camel_seekable_stream_seek (sp, ss->bound_start, CAMEL_STREAM_SET, NULL) == ss->bound_start);
@@ -135,27 +142,34 @@ test_seekable_substream_writepart (CamelStream *s, gint type)
check (camel_seekable_stream_tell (CAMEL_SEEKABLE_STREAM (s)) == ss->bound_start);
- check(camel_stream_write(s, "", 0, NULL) == 0);
+ check (camel_stream_write (s, "", 0, NULL, NULL) == 0);
check (camel_seekable_stream_tell (CAMEL_SEEKABLE_STREAM (s)) == ss->bound_start);
/* fill up the bounds with writes */
if (ss->bound_end != CAMEL_STREAM_UNBOUND) {
for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof (teststring);i++) {
- check (camel_stream_write (s, teststring, sizeof (teststring), NULL) == sizeof (teststring));
+ check (camel_stream_write (
+ s, teststring, sizeof (teststring), NULL, NULL)
+ == sizeof (teststring));
check (camel_seekable_stream_tell (CAMEL_SEEKABLE_STREAM (s)) == ss->bound_start + (i+1)*sizeof (teststring));
}
len = (ss->bound_end-ss->bound_start) % sizeof (teststring);
- check (camel_stream_write (s, teststring, len, NULL) == len);
+ check (camel_stream_write (s, teststring, len, NULL, NULL) == len);
check (camel_seekable_stream_tell (CAMEL_SEEKABLE_STREAM (s)) == ss->bound_end);
if (G_UNLIKELY (type == G_TYPE_INVALID)) {
- check (camel_stream_write (s, teststring, sizeof (teststring), NULL) == 0);
+ check (camel_stream_write (
+ s, teststring, sizeof (teststring),
+ NULL, NULL) == 0);
check (camel_stream_eos (s));
check (camel_seekable_stream_tell (CAMEL_SEEKABLE_STREAM (s)) == ss->bound_end);
}
} else {
/* just 10K */
for (i=0;i<10240;i++) {
- check (camel_stream_write (CAMEL_STREAM (s), teststring, sizeof (teststring), NULL) == sizeof (teststring));
+ check (camel_stream_write (
+ CAMEL_STREAM (s), teststring,
+ sizeof (teststring), NULL, NULL)
+ == sizeof (teststring));
check (camel_seekable_stream_tell (CAMEL_SEEKABLE_STREAM (s)) == ss->bound_start + (i+1)*sizeof (teststring));
}
@@ -173,7 +187,7 @@ test_seekable_substream_readpart (CamelStream *s)
CamelSeekableStream *sp = sus->parent_stream;
gint i, len;
- push("reading substream");
+ push ("reading substream");
check (camel_seekable_stream_seek (ss, 0, CAMEL_STREAM_SET, NULL) == ss->bound_start);
check (camel_seekable_stream_tell (ss) == ss->bound_start);
@@ -184,54 +198,54 @@ test_seekable_substream_readpart (CamelStream *s)
/* check writes, cross check with parent stream */
if (ss->bound_end != CAMEL_STREAM_UNBOUND) {
for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof (teststring);i++) {
- check (camel_stream_read (s, testbuf, sizeof (teststring), NULL) == sizeof (teststring));
+ check (camel_stream_read (
+ s, testbuf, sizeof (teststring), NULL, NULL)
+ == sizeof (teststring));
check (memcmp (testbuf, teststring, sizeof (teststring)) == 0);
check (camel_seekable_stream_tell (ss) == ss->bound_start + (i+1)*sizeof (teststring));
/* yeah great, the substreams affect the seek ... */
check (camel_seekable_stream_seek (sp, ss->bound_start + (i)*sizeof (teststring), CAMEL_STREAM_SET, NULL) == ss->bound_start + i*sizeof (teststring));
- check (camel_stream_read (CAMEL_STREAM (sp), testbuf, sizeof (teststring), NULL) == sizeof (teststring));
+ check (camel_stream_read (
+ CAMEL_STREAM (sp), testbuf,
+ sizeof (teststring), NULL, NULL)
+ == sizeof (teststring));
check (memcmp (testbuf, teststring, sizeof (teststring)) == 0);
check (camel_seekable_stream_tell (sp) == ss->bound_start + (i+1)*sizeof (teststring));
}
len = (ss->bound_end-ss->bound_start) % sizeof (teststring);
- check (camel_stream_read (s, testbuf, len, NULL) == len);
+ check (camel_stream_read (s, testbuf, len, NULL, NULL) == len);
check (memcmp (testbuf, teststring, len) == 0);
check (camel_seekable_stream_seek (sp, ss->bound_end - len, CAMEL_STREAM_SET, NULL) == ss->bound_end - len);
- check (camel_stream_read (CAMEL_STREAM (sp), testbuf, len, NULL) == len);
+ check (camel_stream_read (
+ CAMEL_STREAM (sp), testbuf, len, NULL, NULL) == len);
check (memcmp (testbuf, teststring, len) == 0);
check (camel_stream_eos (s));
check (camel_seekable_stream_tell (ss) == ss->bound_end);
check (camel_seekable_stream_tell (sp) == ss->bound_end);
- check (camel_stream_read (s, testbuf, 1024, NULL) == 0);
+ check (camel_stream_read (s, testbuf, 1024, NULL, NULL) == 0);
check (camel_seekable_stream_tell (ss) == ss->bound_end);
check (camel_seekable_stream_tell (sp) == ss->bound_end);
check (camel_stream_eos (s));
} else {
/* just 10K */
for (i=0;i<10240;i++) {
- check (camel_stream_read (s, testbuf, sizeof (teststring), NULL) == sizeof (teststring));
+ check (camel_stream_read (
+ s, testbuf, sizeof (teststring), NULL, NULL)
+ == sizeof (teststring));
check (memcmp (testbuf, teststring, sizeof (teststring)) == 0);
check (camel_seekable_stream_tell (ss) == ss->bound_start + (i+1)*sizeof (teststring));
check (camel_seekable_stream_seek (sp, ss->bound_start + (i)*sizeof (teststring), CAMEL_STREAM_SET, NULL) == ss->bound_start + i*sizeof (teststring));
- check (camel_stream_read (CAMEL_STREAM (sp), testbuf, sizeof (teststring), NULL) == sizeof (teststring));
+ check (camel_stream_read (
+ CAMEL_STREAM (sp), testbuf,
+ sizeof (teststring), NULL, NULL)
+ == sizeof (teststring));
check (memcmp (testbuf, teststring, sizeof (teststring)) == 0);
check (camel_seekable_stream_tell (sp) == ss->bound_start + (i+1)*sizeof (teststring));
}
-
- /* unbound - we dont know the real length */
-#if 0
- end = 10240*sizeof (teststring)+ss->bound_start;
-
- check (camel_seekable_stream_seek (ss, 0, CAMEL_STREAM_END) == end);
- check (camel_seekable_stream_tell (ss) == end);
- /* need to read 0 first to set eos */
- check (camel_stream_read (s, testbuf, 10240) == 0);
- check (camel_stream_eos (s));
-#endif
}
pull ();
diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c
index 969f08c..d2546c8 100644
--- a/camel/tests/message/test2.c
+++ b/camel/tests/message/test2.c
@@ -82,7 +82,7 @@ gint main (gint argc, gchar **argv)
gint i;
CamelInternetAddress *addr, *addr2;
gchar *name;
- gchar *charset;
+ const gchar *charset;
const gchar *real, *where;
gchar *enc, *enc2, *format, *format2;
diff --git a/camel/tests/message/test4.c b/camel/tests/message/test4.c
index b342c1a..3df1528 100644
--- a/camel/tests/message/test4.c
+++ b/camel/tests/message/test4.c
@@ -102,7 +102,8 @@ gint main (gint argc, gchar **argv)
stream = camel_stream_fs_new_with_fd (fd);
message = camel_mime_message_new ();
- camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream, NULL);
+ camel_data_wrapper_construct_from_stream_sync (
+ CAMEL_DATA_WRAPPER (message), stream, NULL, NULL);
camel_stream_reset (stream, NULL);
/*dump_mime_struct ((CamelMimePart *) message, 0);*/
diff --git a/camel/tests/mime-filter/test-charset.c b/camel/tests/mime-filter/test-charset.c
index 7aaf5b4..6c13871 100644
--- a/camel/tests/mime-filter/test-charset.c
+++ b/camel/tests/mime-filter/test-charset.c
@@ -22,7 +22,7 @@ main (gint argc, gchar **argv)
gchar comp_correct[CHUNK_SIZE], comp_filter[CHUNK_SIZE];
CamelStream *source;
CamelStream *correct;
- CamelStreamFilter *filter;
+ CamelStream *stream;
CamelMimeFilter *f;
struct dirent *dent;
gint i, test = 0;
@@ -63,7 +63,7 @@ main (gint argc, gchar **argv)
}
g_free (outfile);
- if (!(filter = camel_stream_filter_new (CAMEL_STREAM (source)))) {
+ if (!(stream = camel_stream_filter_new (CAMEL_STREAM (source)))) {
camel_test_fail ("Couldn't create CamelStreamFilter??");
continue;
}
@@ -79,7 +79,7 @@ main (gint argc, gchar **argv)
}
g_free (charset);
- camel_stream_filter_add (filter, f);
+ camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), f);
g_object_unref (f);
camel_test_push ("Running filter and comparing to correct result");
@@ -87,7 +87,9 @@ main (gint argc, gchar **argv)
comp_progress = 0;
while (1) {
- comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE, NULL);
+ comp_correct_chunk = camel_stream_read (
+ correct, comp_correct,
+ CHUNK_SIZE, NULL, NULL);
comp_filter_chunk = 0;
if (comp_correct_chunk == 0)
@@ -96,9 +98,11 @@ main (gint argc, gchar **argv)
while (comp_filter_chunk < comp_correct_chunk) {
gssize delta;
- delta = camel_stream_read (CAMEL_STREAM (filter),
- comp_filter + comp_filter_chunk,
- CHUNK_SIZE - comp_filter_chunk, NULL);
+ delta = camel_stream_read (
+ stream,
+ comp_filter + comp_filter_chunk,
+ CHUNK_SIZE - comp_filter_chunk,
+ NULL, NULL);
if (delta == 0) {
camel_test_fail ("Chunks are different sizes: correct is %d, "
@@ -126,7 +130,7 @@ main (gint argc, gchar **argv)
/* inefficient */
camel_test_push ("Cleaning up");
- g_object_unref (CAMEL_OBJECT (filter));
+ g_object_unref (stream);
g_object_unref (CAMEL_OBJECT (correct));
g_object_unref (CAMEL_OBJECT (source));
camel_test_pull ();
diff --git a/camel/tests/mime-filter/test-crlf.c b/camel/tests/mime-filter/test-crlf.c
index 4f46530..9acb6c3 100644
--- a/camel/tests/mime-filter/test-crlf.c
+++ b/camel/tests/mime-filter/test-crlf.c
@@ -25,7 +25,7 @@ main (gint argc, gchar **argv)
{
CamelStream *source;
CamelStream *correct;
- CamelStreamFilter *filter;
+ CamelStream *stream;
CamelMimeFilter *sh;
gchar *work;
gint i;
@@ -80,8 +80,8 @@ main (gint argc, gchar **argv)
}
g_free (outfile);
- filter = camel_stream_filter_new (CAMEL_STREAM (source));
- if (!filter) {
+ stream = camel_stream_filter_new (source);
+ if (!stream) {
camel_test_fail ("Couldn't create CamelStreamFilter??");
continue;
}
@@ -92,7 +92,8 @@ main (gint argc, gchar **argv)
continue;
}
- camel_stream_filter_add (filter, sh);
+ camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (stream), sh);
camel_test_pull ();
camel_test_push ("Running filter and comparing to correct result");
@@ -100,7 +101,9 @@ main (gint argc, gchar **argv)
comp_progress = 0;
while (1) {
- comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE, NULL);
+ comp_correct_chunk = camel_stream_read (
+ correct, comp_correct,
+ CHUNK_SIZE, NULL, NULL);
comp_filter_chunk = 0;
if (comp_correct_chunk == 0)
@@ -109,9 +112,11 @@ main (gint argc, gchar **argv)
while (comp_filter_chunk < comp_correct_chunk) {
gssize delta;
- delta = camel_stream_read (CAMEL_STREAM (filter),
- comp_filter + comp_filter_chunk,
- CHUNK_SIZE - comp_filter_chunk, NULL);
+ delta = camel_stream_read (
+ stream,
+ comp_filter + comp_filter_chunk,
+ CHUNK_SIZE - comp_filter_chunk,
+ NULL, NULL);
if (delta == 0) {
camel_test_fail ("Chunks are different sizes: correct is %d, "
@@ -139,10 +144,10 @@ main (gint argc, gchar **argv)
/* inefficient */
camel_test_push ("Cleaning up");
- g_object_unref (CAMEL_OBJECT (filter));
- g_object_unref (CAMEL_OBJECT (correct));
- g_object_unref (CAMEL_OBJECT (source));
- g_object_unref (CAMEL_OBJECT (sh));
+ g_object_unref (stream);
+ g_object_unref (correct);
+ g_object_unref (source);
+ g_object_unref (sh);
camel_test_pull ();
camel_test_pull ();
diff --git a/camel/tests/mime-filter/test-tohtml.c b/camel/tests/mime-filter/test-tohtml.c
index bed97af..316fee7 100644
--- a/camel/tests/mime-filter/test-tohtml.c
+++ b/camel/tests/mime-filter/test-tohtml.c
@@ -38,7 +38,7 @@ test_filter (CamelMimeFilter *f, const gchar *inname, const gchar *outname)
byte_array_out = g_byte_array_new ();
out = camel_stream_mem_new_with_byte_array (byte_array_out);
- check (camel_stream_write_to_stream (outdisk, out, NULL) > 0);
+ check (camel_stream_write_to_stream (outdisk, out, NULL, NULL) > 0);
camel_test_pull ();
@@ -52,7 +52,7 @@ test_filter (CamelMimeFilter *f, const gchar *inname, const gchar *outname)
id = camel_stream_filter_add ((CamelStreamFilter *)filter, f);
check_count (f, 2);
- check (camel_stream_write_to_stream (filter, in, NULL) > 0);
+ check (camel_stream_write_to_stream (filter, in, NULL, NULL) > 0);
check_msg (byte_array_in->len == byte_array_out->len
&& memcmp (byte_array_in->data, byte_array_out->data, byte_array_in->len) == 0,
"Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", byte_array_in->len, byte_array_out->len,
@@ -80,8 +80,8 @@ test_filter (CamelMimeFilter *f, const gchar *inname, const gchar *outname)
id = camel_stream_filter_add ((CamelStreamFilter *)filter, f);
check_count (f, 2);
- check (camel_stream_write_to_stream (indisk, filter, NULL) > 0);
- check (camel_stream_flush (filter, NULL) == 0);
+ check (camel_stream_write_to_stream (indisk, filter, NULL, NULL) > 0);
+ check (camel_stream_flush (filter, NULL, NULL) == 0);
check_msg (byte_array_in->len == byte_array_out->len
&& memcmp (byte_array_in->data, byte_array_out->data, byte_array_in->len) == 0,
"Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", byte_array_in->len, byte_array_out->len,
diff --git a/camel/tests/mime-filter/test1.c b/camel/tests/mime-filter/test1.c
index a69107e..4fda01f 100644
--- a/camel/tests/mime-filter/test1.c
+++ b/camel/tests/mime-filter/test1.c
@@ -9,7 +9,7 @@
#include "camel-test.h"
-#define d(x)
+#define d (x)
#define NUM_CASES 1
#define CHUNK_SIZE 4096
@@ -51,18 +51,18 @@ struct {
gint
main (gint argc, gchar **argv)
{
- CamelStream *filter;
+ CamelStream *stream;
CamelMimeFilter *sh;
gint i;
camel_test_init (argc, argv);
- camel_test_start("canonicalisation filter tests");
+ camel_test_start ("canonicalisation filter tests");
for (i = 0; i < G_N_ELEMENTS (tests); i++) {
gint step;
- camel_test_push("Data test %d '%s'\n", i, tests[i].in);
+ camel_test_push ("Data test %d '%s'\n", i, tests[i].in);
/* try all write sizes */
for (step=1;step<20;step++) {
@@ -70,27 +70,29 @@ main (gint argc, gchar **argv)
CamelStream *out;
const gchar *p;
- camel_test_push("Chunk size %d\n", step);
+ camel_test_push ("Chunk size %d\n", step);
byte_array = g_byte_array_new ();
out = camel_stream_mem_new_with_byte_array (byte_array);
- filter = camel_stream_filter_new (out);
+ stream = camel_stream_filter_new (out);
sh = camel_mime_filter_canon_new (tests[i].flags);
- check (camel_stream_filter_add (filter, sh) != -1);
+ check (camel_stream_filter_add (
+ CAMEL_STREAM_FILTER (stream), sh) != -1);
check_unref (sh, 2);
p = tests[i].in;
while (*p) {
gint w = MIN (strlen (p), step);
- check (camel_stream_write ((CamelStream *)filter, p, w, NULL) == w);
+ check (camel_stream_write (
+ stream, p, w, NULL, NULL) == w);
p += w;
}
- camel_stream_flush ((CamelStream *)filter, NULL);
+ camel_stream_flush (stream, NULL, NULL);
- check_msg(byte_array->len == strlen(tests[i].out), "Buffer length mismatch: expected %d got %d\n or '%s' got '%.*s'", strlen(tests[i].out), byte_array->len, tests[i].out, byte_array->len, byte_array->data);
- check_msg(0 == memcmp(byte_array->data, tests[i].out, byte_array->len), "Buffer mismatch: expected '%s' got '%.*s'", tests[i].out, byte_array->len, byte_array->data);
- check_unref (filter, 1);
+ check_msg (byte_array->len == strlen (tests[i].out), "Buffer length mismatch: expected %d got %d\n or '%s' got '%.*s'", strlen (tests[i].out), byte_array->len, tests[i].out, byte_array->len, byte_array->data);
+ check_msg (0 == memcmp (byte_array->data, tests[i].out, byte_array->len), "Buffer mismatch: expected '%s' got '%.*s'", tests[i].out, byte_array->len, byte_array->data);
+ check_unref (stream, 1);
check_unref (out, 1);
camel_test_pull ();
diff --git a/camel/tests/misc/utf7.c b/camel/tests/misc/utf7.c
index cfe56ed..bad56d8 100644
--- a/camel/tests/misc/utf7.c
+++ b/camel/tests/misc/utf7.c
@@ -8,7 +8,7 @@
#include "camel-test.h"
static struct {
- guchar *utf8;
+ const gchar *utf8;
const gchar *utf7;
guint32 unicode[200];
} tests[] = {
@@ -42,7 +42,8 @@ static struct {
gint
main (gint argc, gchar **argv)
{
- gchar *utf8, *utf7, *p;
+ const gchar *p;
+ gchar *utf8, *utf7;
gint i, j;
guint32 u;
gchar utf8enc[256];
@@ -50,13 +51,13 @@ main (gint argc, gchar **argv)
camel_test_init (argc, argv);
- out = g_string_new("");
+ out = g_string_new ("");
- camel_test_start("UTF8, UTF7 RFC1642+RFC2060");
+ camel_test_start ("UTF8, UTF7 RFC1642+RFC2060");
for (i = 0; i < G_N_ELEMENTS (tests); i++) {
- camel_test_push("%2d: %s utf8 decode", i, tests[i].utf7);
+ camel_test_push ("%2d: %s utf8 decode", i, tests[i].utf7);
p = tests[i].utf8;
j = 0;
do {
@@ -66,20 +67,20 @@ main (gint argc, gchar **argv)
} while (u);
camel_test_pull ();
- camel_test_push("%2d: %s utf7->utf8", i, tests[i].utf7);
+ camel_test_push ("%2d: %s utf7->utf8", i, tests[i].utf7);
utf8 = camel_utf7_utf8 (tests[i].utf7);
- check_msg(strcmp(utf8, tests[i].utf8) == 0, "utf8 = '%s'", utf8);
+ check_msg (strcmp (utf8, tests[i].utf8) == 0, "utf8 = '%s'", utf8);
camel_test_pull ();
- camel_test_push("%2d: %s utf7->utf8->utf7", i, tests[i].utf7);
+ camel_test_push ("%2d: %s utf7->utf8->utf7", i, tests[i].utf7);
utf7 = camel_utf8_utf7 (utf8);
- check_msg(strcmp(utf7, tests[i].utf7) == 0, "utf7 = '%s'", utf7);
+ check_msg (strcmp (utf7, tests[i].utf7) == 0, "utf7 = '%s'", utf7);
camel_test_pull ();
g_free (utf7);
g_free (utf8);
- camel_test_push("%2d: %s utf8 encode", i, tests[i].utf7);
+ camel_test_push ("%2d: %s utf8 encode", i, tests[i].utf7);
g_string_truncate (out, 0);
p = utf8enc;
diff --git a/camel/tests/smime/pgp.c b/camel/tests/smime/pgp.c
index 7d371ba..f4f9482 100644
--- a/camel/tests/smime/pgp.c
+++ b/camel/tests/smime/pgp.c
@@ -33,9 +33,9 @@
#include "session.h"
#define CAMEL_TYPE_PGP_SESSION (camel_pgp_session_get_type ())
-#define CAMEL_PGP_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), CAMEL_TYPE_PGP_SESSION, CamelPgpSession))
-#define CAMEL_PGP_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CAMEL_TYPE_PGP_SESSION, CamelPgpSessionClass))
-#define CAMEL_PGP_IS_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), CAMEL_TYPE_PGP_SESSION))
+#define CAMEL_PGP_SESSION (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAMEL_TYPE_PGP_SESSION, CamelPgpSession))
+#define CAMEL_PGP_SESSION_CLASS (k) (G_TYPE_CHECK_CLASS_CAST ((k), CAMEL_TYPE_PGP_SESSION, CamelPgpSessionClass))
+#define CAMEL_PGP_IS_SESSION (o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CAMEL_TYPE_PGP_SESSION))
typedef struct _CamelPgpSession {
CamelSession parent_object;
@@ -102,7 +102,7 @@ gint main (gint argc, gchar **argv)
gint ret;
GError *error = NULL;
- if (getenv("CAMEL_TEST_GPG") == NULL)
+ if (getenv ("CAMEL_TEST_GPG") == NULL)
return 77;
camel_test_init (argc, argv);
@@ -131,12 +131,14 @@ gint main (gint argc, gchar **argv)
camel_test_start ("Test of PGP functions");
stream1 = camel_stream_mem_new ();
- camel_stream_write (stream1, "Hello, I am a test stream.\n", 27, NULL);
+ camel_stream_write (
+ stream1, "Hello, I am a test stream.\n", 27, NULL, NULL);
camel_stream_reset (stream1, NULL);
conpart = camel_mime_part_new ();
dw = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (dw, stream1, NULL);
+ camel_data_wrapper_construct_from_stream_sync (
+ dw, stream1, NULL, NULL);
camel_medium_set_content ((CamelMedium *)conpart, dw);
g_object_unref (stream1);
g_object_unref (dw);
@@ -144,9 +146,11 @@ gint main (gint argc, gchar **argv)
sigpart = camel_mime_part_new ();
camel_test_push ("PGP signing");
- camel_cipher_sign (ctx, "no user no domain", CAMEL_CIPHER_HASH_SHA1, conpart, sigpart, &error);
+ camel_cipher_context_sign_sync (
+ ctx, "no user no domain", CAMEL_CIPHER_HASH_SHA1,
+ conpart, sigpart, NULL, &error);
if (error != NULL) {
- printf("PGP signing failed assuming non-functional environment\n%s", error->message);
+ printf ("PGP signing failed assuming non-functional environment\n%s", error->message);
camel_test_pull ();
return 77;
}
@@ -155,7 +159,7 @@ gint main (gint argc, gchar **argv)
g_clear_error (&error);
camel_test_push ("PGP verify");
- valid = camel_cipher_verify (ctx, sigpart, &error);
+ valid = camel_cipher_context_verify_sync (ctx, sigpart, NULL, &error);
check_msg (error == NULL, "%s", error->message);
check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid));
camel_cipher_validity_free (valid);
@@ -165,13 +169,16 @@ gint main (gint argc, gchar **argv)
g_object_unref (sigpart);
stream1 = camel_stream_mem_new ();
- camel_stream_write (stream1, "Hello, I am a test of encryption/decryption.", 44, NULL);
+ camel_stream_write (
+ stream1, "Hello, I am a test of encryption/decryption.",
+ 44, NULL, NULL);
camel_stream_reset (stream1, NULL);
conpart = camel_mime_part_new ();
dw = camel_data_wrapper_new ();
camel_stream_reset (stream1, NULL);
- camel_data_wrapper_construct_from_stream (dw, stream1, NULL);
+ camel_data_wrapper_construct_from_stream_sync (
+ dw, stream1, NULL, NULL);
camel_medium_set_content ((CamelMedium *)conpart, dw);
g_object_unref (stream1);
g_object_unref (dw);
@@ -183,7 +190,9 @@ gint main (gint argc, gchar **argv)
camel_test_push ("PGP encrypt");
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, (guint8 *) "no user no domain");
- camel_cipher_encrypt (ctx, "no user no domain", recipients, conpart, encpart, &error);
+ camel_cipher_context_encrypt_sync (
+ ctx, "no user no domain", recipients,
+ conpart, encpart, NULL, &error);
check_msg (error == NULL, "%s", error->message);
g_ptr_array_free (recipients, TRUE);
camel_test_pull ();
@@ -192,7 +201,8 @@ gint main (gint argc, gchar **argv)
camel_test_push ("PGP decrypt");
outpart = camel_mime_part_new ();
- valid = camel_cipher_decrypt (ctx, encpart, outpart, &error);
+ valid = camel_cipher_context_decrypt_sync (
+ ctx, encpart, outpart, NULL, &error);
check_msg (error == NULL, "%s", error->message);
check_msg (valid->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, "%s", valid->encrypt.description);
@@ -201,8 +211,10 @@ gint main (gint argc, gchar **argv)
buffer2 = g_byte_array_new ();
stream2 = camel_stream_mem_new_with_byte_array (buffer2);
- camel_data_wrapper_write_to_stream ((CamelDataWrapper *)conpart, stream1, NULL);
- camel_data_wrapper_write_to_stream ((CamelDataWrapper *)outpart, stream2, NULL);
+ camel_data_wrapper_write_to_stream_sync (
+ CAMEL_DATA_WRAPPER (conpart), stream1, NULL, NULL);
+ camel_data_wrapper_write_to_stream_sync (
+ CAMEL_DATA_WRAPPER (outpart), stream2, NULL, NULL);
before = g_strndup ((gchar *) buffer1->data, buffer1->len);
after = g_strndup ((gchar *) buffer2->data, buffer2->len);
diff --git a/camel/tests/stream/test1.c b/camel/tests/stream/test1.c
index 37fba0b..0077930 100644
--- a/camel/tests/stream/test1.c
+++ b/camel/tests/stream/test1.c
@@ -20,66 +20,66 @@ main (gint argc, gchar **argv)
camel_test_init (argc, argv);
- camel_test_start("CamelStream fs, open, seek, read, write, eos");
+ camel_test_start ("CamelStream fs, open, seek, read, write, eos");
for (i=0;i<2;i++) {
- (void)unlink("stream.txt");
+ (void)unlink ("stream.txt");
- push("trying to open a nonexistant stream, method %d", i);
+ push ("trying to open a nonexistant stream, method %d", i);
switch (i) {
case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0, NULL);
+ ss = (CamelSeekableStream *)camel_stream_fs_new_with_name ("stream.txt", O_RDWR, 0, NULL);
break;
case 1:
- fd = open("stream.txt", O_RDWR, 0);
+ fd = open ("stream.txt", O_RDWR, 0);
ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd (fd);
break;
}
check (ss == NULL && errno == ENOENT);
- check(g_stat("stream.txt", &st) == -1 && errno == ENOENT);
+ check (g_stat ("stream.txt", &st) == -1 && errno == ENOENT);
pull ();
- push("Creating stream using method %d", i);
+ push ("Creating stream using method %d", i);
switch (i) {
case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600, NULL);
+ ss = (CamelSeekableStream *)camel_stream_fs_new_with_name ("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600, NULL);
fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
break;
case 1:
- fd = open("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600);
+ fd = open ("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600);
ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd (fd);
break;
}
check (ss != NULL);
- check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
+ check (g_stat ("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG (st.st_mode) && st.st_size == 0);
pull ();
test_stream_seekable_writepart (ss);
test_stream_seekable_readpart (ss);
- push("getting filesize");
- check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode));
+ push ("getting filesize");
+ check (g_stat ("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG (st.st_mode));
size = st.st_size;
pull ();
- push("checking close closes");
+ push ("checking close closes");
check_unref (ss, 1);
check (close (fd) == -1);
pull ();
- push("re-opening stream");
+ push ("re-opening stream");
switch (i) {
case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0, NULL);
+ ss = (CamelSeekableStream *)camel_stream_fs_new_with_name ("stream.txt", O_RDWR, 0, NULL);
fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
break;
case 1:
- fd = open("stream.txt", O_RDWR, 0);
+ fd = open ("stream.txt", O_RDWR, 0);
ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd (fd);
break;
}
check (ss != NULL);
- check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == size);
+ check (g_stat ("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG (st.st_mode) && st.st_size == size);
test_stream_seekable_readpart (ss);
@@ -87,29 +87,30 @@ main (gint argc, gchar **argv)
check (close (fd) == -1);
pull ();
- push("re-opening stream with truncate");
+ push ("re-opening stream with truncate");
switch (i) {
case 0:
- ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_TRUNC, 0, NULL);
+ ss = (CamelSeekableStream *)camel_stream_fs_new_with_name ("stream.txt", O_RDWR|O_TRUNC, 0, NULL);
fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
break;
case 1:
- fd = open("stream.txt", O_RDWR|O_TRUNC, 0);
+ fd = open ("stream.txt", O_RDWR|O_TRUNC, 0);
ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd (fd);
break;
}
check (ss != NULL);
- check(g_stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0);
+ check (g_stat ("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG (st.st_mode) && st.st_size == 0);
/* read has to return 0 before eos is set */
- check (camel_stream_read (CAMEL_STREAM (ss), buffer, 1, NULL) == 0);
+ check (camel_stream_read (
+ CAMEL_STREAM (ss), buffer, 1, NULL, NULL) == 0);
check (camel_stream_eos (CAMEL_STREAM (ss)));
check_unref (ss, 1);
check (close (fd) == -1);
pull ();
- (void)unlink("stream.txt");
+ (void)unlink ("stream.txt");
}
camel_test_end ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]