diff --git a/src/tests/test-mu-cmd-cfind.c b/src/tests/test-mu-cmd-cfind.c new file mode 100644 index 00000000..e41412f7 --- /dev/null +++ b/src/tests/test-mu-cmd-cfind.c @@ -0,0 +1,281 @@ +/* -*- mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- +** +** Copyright (C) 2008-2011 Dirk-Jan C. Binnema +** +** This program is free software; you can redistribute it and/or modify it +** under the terms of the GNU General Public License as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software Foundation, +** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +** +*/ + +#if HAVE_CONFIG_H +#include "config.h" +#endif /*HAVE_CONFIG_H*/ + +#include +#include + +#include "../mu-query.h" + +#include +#include +#include + +#include "test-mu-common.h" +#include "src/mu-store.h" + +static gchar* +fill_contacts_cache (void) +{ + gchar *cmdline, *tmpdir; + + tmpdir = test_mu_common_get_random_tmpdir(); + cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s" + " --quiet", + MU_PROGRAM, tmpdir, MU_TESTMAILDIR); + + g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, + NULL, NULL)); + g_free (cmdline); + + return tmpdir; +} + + +static void +test_mu_cfind_plain (void) +{ + gchar *muhome, *cmdline, *output, *erroutput; + + muhome = fill_contacts_cache (); + g_assert (muhome != NULL); + + cmdline = g_strdup_printf ("%s cfind --muhome=%s --format=plain " + "'testmu\\.xxx?'", + MU_PROGRAM, muhome); + + output = erroutput = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, + NULL, NULL)); + g_assert_cmpstr (output, + ==, + "Helmut Kröger hk@testmu.xxx\n" + "Mü testmu@testmu.xx\n"); + g_free (cmdline); + g_free (muhome); + g_free (output); + g_free (erroutput); +} + +static void +test_mu_cfind_bbdb (void) +{ + gchar *muhome, *cmdline, *output, *erroutput; + + muhome = fill_contacts_cache (); + g_assert (muhome != NULL); + + cmdline = g_strdup_printf ("%s cfind --muhome=%s --format=bbdb " + "'testmu\\.xxx?'", + MU_PROGRAM, muhome); + + output = erroutput = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, + NULL, NULL)); + g_assert_cmpstr (output, + ==, + ";; -*-coding: utf-8-emacs;-*-\n" + ";;; file-version: 6\n" + + "[\"Helmut\" \"Kröger\" nil nil nil nil (\"hk@testmu.xxx\") " + "((creation-date . \"2011-05-19\") " + "(time-stamp . \"1970-01-01\")) nil]\n" + + "[\"Mü\" \"\" nil nil nil nil (\"testmu@testmu.xx\") " + "((creation-date . \"2011-05-19\") " + "(time-stamp . \"1970-01-01\")) nil]\n"); + + g_free (cmdline); + g_free (muhome); + g_free (output); + g_free (erroutput); +} + + +static void +test_mu_cfind_wl (void) +{ + gchar *muhome, *cmdline, *output, *erroutput; + + muhome = fill_contacts_cache (); + g_assert (muhome != NULL); + + cmdline = g_strdup_printf ("%s cfind --muhome=%s --format=wl " + "'testmu\\.xxx?'", + MU_PROGRAM, muhome); + + output = erroutput = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, + NULL, NULL)); + g_assert_cmpstr (output, + ==, + "hk@testmu.xxx \"HelmutK\" \"Helmut Kröger\"\n" + "testmu@testmu.xx \"Mü\" \"Mü\"\n"); + g_free (cmdline); + g_free (muhome); + g_free (output); + g_free (erroutput); +} + + +static void +test_mu_cfind_mutt_alias (void) +{ + gchar *muhome, *cmdline, *output, *erroutput; + + muhome = fill_contacts_cache (); + g_assert (muhome != NULL); + + cmdline = g_strdup_printf ("%s cfind --muhome=%s --format=mutt-alias " + "'testmu\\.xxx?'", + MU_PROGRAM, muhome); + + output = erroutput = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, + NULL, NULL)); + g_assert_cmpstr (output, + ==, + "alias HelmutK Helmut Kröger \n" + "alias Mü Mü \n"); + g_free (cmdline); + g_free (muhome); + g_free (output); + g_free (erroutput); +} + +static void +test_mu_cfind_mutt_ab (void) +{ + gchar *muhome, *cmdline, *output, *erroutput; + + muhome = fill_contacts_cache (); + g_assert (muhome != NULL); + + cmdline = g_strdup_printf ("%s cfind --muhome=%s --format=mutt-ab " + "'testmu\\.xxx?'", + MU_PROGRAM, muhome); + + output = erroutput = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, + NULL, NULL)); + g_assert_cmpstr (output, + ==, + "hk@testmu.xxx\tHelmut Kröger\t\n" + "testmu@testmu.xx\tMü\t\n"); + g_free (cmdline); + g_free (muhome); + g_free (output); + g_free (erroutput); +} + + +static void +test_mu_cfind_org_contact (void) +{ + gchar *muhome, *cmdline, *output, *erroutput; + + muhome = fill_contacts_cache (); + g_assert (muhome != NULL); + + cmdline = g_strdup_printf ("%s cfind --muhome=%s --format=org-contact " + "'testmu\\.xxx?'", + MU_PROGRAM, muhome); + + output = erroutput = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, + NULL, NULL)); + g_assert_cmpstr (output, + ==, + "* Helmut Kröger\n" + ":PROPERTIES:\n" + ":EMAIL: hk@testmu.xxx\n" + ":END:\n\n" + + "* Mü\n" + ":PROPERTIES:\n" + ":EMAIL: testmu@testmu.xx\n" + ":END:\n\n"); + g_free (cmdline); + g_free (muhome); + g_free (output); + g_free (erroutput); +} + + + +static void +test_mu_cfind_csv (void) +{ + gchar *muhome, *cmdline, *output, *erroutput; + + muhome = fill_contacts_cache (); + g_assert (muhome != NULL); + + cmdline = g_strdup_printf ("%s cfind --muhome=%s --format=csv " + "'testmu\\.xxx?'", + MU_PROGRAM, muhome); + + output = erroutput = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, &erroutput, + NULL, NULL)); + g_assert_cmpstr (output, + ==, + "Helmut Kröger,hk@testmu.xxx\n" + "Mü,testmu@testmu.xx\n"); + g_free (cmdline); + g_free (muhome); + g_free (output); + g_free (erroutput); +} + + + + +int +main (int argc, char *argv[]) +{ + int rv; + g_test_init (&argc, &argv, NULL); + + g_test_add_func ("/mu-cmd-cfind/test-mu-cfind-plain", test_mu_cfind_plain); + g_test_add_func ("/mu-cmd-cfind/test-mu-cfind-bbdb", test_mu_cfind_bbdb); + g_test_add_func ("/mu-cmd-cfind/test-mu-cfind-wl", test_mu_cfind_wl); + g_test_add_func ("/mu-cmd-cfind/test-mu-cfind-mutt-alias", + test_mu_cfind_mutt_alias); + g_test_add_func ("/mu-cmd-cfind/test-mu-cfind-mutt-ab", + test_mu_cfind_mutt_ab); + g_test_add_func ("/mu-cmd-cfind/test-mu-cfind-org-contact", + test_mu_cfind_org_contact); + g_test_add_func ("/mu-cmd-cfind/test-mu-cfind-csv", + test_mu_cfind_csv); + + g_log_set_handler (NULL, + G_LOG_LEVEL_MASK | G_LOG_LEVEL_WARNING| + G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, + (GLogFunc)black_hole, NULL); + + rv = g_test_run (); + + return rv; +} + diff --git a/src/tests/test-mu-cmd.c b/src/tests/test-mu-cmd.c index 9a575310..e5ca6ef6 100644 --- a/src/tests/test-mu-cmd.c +++ b/src/tests/test-mu-cmd.c @@ -484,7 +484,6 @@ main (int argc, char *argv[]) G_LOG_LEVEL_MASK | G_LOG_LEVEL_WARNING| G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, (GLogFunc)black_hole, NULL); - rv = g_test_run (); return rv; diff --git a/src/tests/test-mu-msg-file.c b/src/tests/test-mu-msg-file.c deleted file mode 100644 index 5eeecc98..00000000 --- a/src/tests/test-mu-msg-file.c +++ /dev/null @@ -1,108 +0,0 @@ -/* -** Copyright (C) 2008-2010 Dirk-Jan C. Binnema -** -** This program is free software; you can redistribute it and/or modify it -** under the terms of the GNU General Public License as published by the -** Free Software Foundation; either version 3, or (at your option) any -** later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software Foundation, -** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -** -*/ - -#if HAVE_CONFIG_H -#include "config.h" -#endif /*HAVE_CONFIG_H */ - -#include -#include -#include -#include - -#include - -#include "test-mu-common.h" -#include "src/mu-maildir.h" - -static void -test_mu_maildir_get_flags_from_path(void) -{ - int i; - - struct { - const char *path; - MuMsgFlags flags; - } paths[] = { - { - "/home/foo/Maildir/test/cur/123456:2,FSR", - MU_MSG_FLAG_REPLIED | MU_MSG_FLAG_SEEN | MU_MSG_FLAG_FLAGGED}, { - "/home/foo/Maildir/test/new/123456", - MU_MSG_FLAG_NEW | MU_MSG_FLAG_UNREAD}, { - "/home/foo/Maildir/test/new/123456:2,FR", - MU_MSG_FLAG_NEW | MU_MSG_FLAG_UNREAD}, { - "/home/foo/Maildir/test/cur/123456:2,DTP", - MU_MSG_FLAG_DRAFT | MU_MSG_FLAG_TRASHED | - MU_MSG_FLAG_PASSED | MU_MSG_FLAG_UNREAD }, { - "/home/foo/Maildir/test/cur/123456:2,S", - MU_MSG_FLAG_SEEN} - }; - - for (i = 0; i != G_N_ELEMENTS(paths); ++i) { - MuMsgFlags flags; - flags = mu_maildir_get_flags_from_path(paths[i].path); - g_assert_cmpuint(flags, ==, paths[i].flags); - } -} - -static void test_mu_maildir_get_path_from_flags(void) -{ - int i; - - struct { - const char *oldpath; - MuMsgFlags flags; - const char *newpath; - } paths[] = { - { - "/home/foo/Maildir/test/cur/123456:2,FR", - MU_MSG_FLAG_REPLIED, - "/home/foo/Maildir/test/cur/123456:2,R"}, { - "/home/foo/Maildir/test/cur/123456:2,FR", - MU_MSG_FLAG_NEW, - "/home/foo/Maildir/test/new/123456"}, { - "/home/foo/Maildir/test/new/123456:2,FR", - MU_MSG_FLAG_SEEN | MU_MSG_FLAG_REPLIED, - "/home/foo/Maildir/test/cur/123456:2,RS"} - }; - - for (i = 0; i != G_N_ELEMENTS(paths); ++i) { - gchar *str; - str = mu_maildir_get_path_from_flags(paths[i].oldpath, - paths[i].flags); - g_assert_cmpstr(str, ==, paths[i].newpath); - g_free(str); - } -} - -int main(int argc, char *argv[]) -{ - g_test_init(&argc, &argv, NULL); - - g_test_add_func("/mu-msg-file/mu-msg-file-get-path-from-flags", - test_mu_maildir_get_path_from_flags); - g_test_add_func("/mu-msg-file/mu-msg-file-get-flags-from-path", - test_mu_maildir_get_flags_from_path); - - g_log_set_handler(NULL, - G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | - G_LOG_FLAG_RECURSION, (GLogFunc) black_hole, NULL); - - return g_test_run(); -} diff --git a/src/tests/test-mu-msg.c b/src/tests/test-mu-msg.c index 5832d43b..1ae50200 100644 --- a/src/tests/test-mu-msg.c +++ b/src/tests/test-mu-msg.c @@ -1,3 +1,5 @@ +/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/ + /* ** Copyright (C) 2008-2011 Dirk-Jan C. Binnema ** @@ -34,25 +36,25 @@ static gboolean check_contact_01 (MuMsgContact *contact, int *idx) { - switch (*idx) { - case 0: - g_assert_cmpstr (mu_msg_contact_name (contact), - ==, "Mickey Mouse"); - g_assert_cmpstr (mu_msg_contact_address (contact), - ==, "anon@example.com"); - break; - case 1: - g_assert_cmpstr (mu_msg_contact_name (contact), - ==, "Donald Duck"); - g_assert_cmpstr (mu_msg_contact_address (contact), - ==, "gcc-help@gcc.gnu.org"); - break; - default: - g_assert_not_reached (); - } - ++(*idx); + switch (*idx) { + case 0: + g_assert_cmpstr (mu_msg_contact_name (contact), + ==, "Mickey Mouse"); + g_assert_cmpstr (mu_msg_contact_address (contact), + ==, "anon@example.com"); + break; + case 1: + g_assert_cmpstr (mu_msg_contact_name (contact), + ==, "Donald Duck"); + g_assert_cmpstr (mu_msg_contact_address (contact), + ==, "gcc-help@gcc.gnu.org"); + break; + default: + g_assert_not_reached (); + } + ++(*idx); - return TRUE; + return TRUE; } @@ -61,35 +63,36 @@ check_contact_01 (MuMsgContact *contact, int *idx) static void test_mu_msg_01 (void) { - MuMsg *msg; - gint i; + MuMsg *msg; + gint i; - msg = mu_msg_new_from_file (MU_TESTMAILDIR - "cur/1220863042.12663_1.mindcrime!2,S", - NULL, NULL); + msg = mu_msg_new_from_file (MU_TESTMAILDIR + "cur/1220863042.12663_1.mindcrime!2,S", + NULL, NULL); - g_assert_cmpstr (mu_msg_get_to(msg), - ==, "Donald Duck "); - g_assert_cmpstr (mu_msg_get_subject(msg), - ==, "gcc include search order"); - g_assert_cmpstr (mu_msg_get_from(msg), - ==, "Mickey Mouse "); - g_assert_cmpstr (mu_msg_get_msgid(msg), - ==, "3BE9E6535E3029448670913581E7A1A20D852173@" - "emss35m06.us.lmco.com"); - /* g_assert_cmpstr (mu_msg_get_header(msg, "Mailing-List"), */ - /* ==, "contact gcc-help-help@gcc.gnu.org; run by ezmlm"); */ - g_assert_cmpuint (mu_msg_get_prio(msg), /* 'klub' */ - ==, MU_MSG_PRIO_NORMAL); - g_assert_cmpuint (mu_msg_get_date(msg), - ==, 1217530645); + g_assert_cmpstr (mu_msg_get_to(msg), + ==, "Donald Duck "); + g_assert_cmpstr (mu_msg_get_subject(msg), + ==, "gcc include search order"); + g_assert_cmpstr (mu_msg_get_from(msg), + ==, "Mickey Mouse "); + g_assert_cmpstr (mu_msg_get_msgid(msg), + ==, "3BE9E6535E3029448670913581E7A1A20D852173@" + "emss35m06.us.lmco.com"); + g_assert_cmpstr (mu_msg_get_header(msg, "Mailing-List"), + ==, + "contact gcc-help-help@gcc.gnu.org; run by ezmlm"); + g_assert_cmpuint (mu_msg_get_prio(msg), /* 'klub' */ + ==, MU_MSG_PRIO_NORMAL); + g_assert_cmpuint (mu_msg_get_date(msg), + ==, 1217530645); - i = 0; - mu_msg_contact_foreach (msg, (MuMsgContactForeachFunc)check_contact_01, - &i); - g_assert_cmpint (i,==,2); + i = 0; + mu_msg_contact_foreach (msg, (MuMsgContactForeachFunc)check_contact_01, + &i); + g_assert_cmpint (i,==,2); - mu_msg_unref (msg); + mu_msg_unref (msg); } @@ -97,25 +100,25 @@ test_mu_msg_01 (void) static gboolean check_contact_02 (MuMsgContact *contact, int *idx) { - switch (*idx) { - case 0: - g_assert_cmpstr (mu_msg_contact_name (contact), - ==, NULL); - g_assert_cmpstr (mu_msg_contact_address (contact), - ==, "anon@example.com"); - break; - case 1: - g_assert_cmpstr (mu_msg_contact_name (contact), - ==, NULL); - g_assert_cmpstr (mu_msg_contact_address (contact), - ==, "help-gnu-emacs@gnu.org"); - break; - default: - g_assert_not_reached (); - } - ++(*idx); + switch (*idx) { + case 0: + g_assert_cmpstr (mu_msg_contact_name (contact), + ==, NULL); + g_assert_cmpstr (mu_msg_contact_address (contact), + ==, "anon@example.com"); + break; + case 1: + g_assert_cmpstr (mu_msg_contact_name (contact), + ==, NULL); + g_assert_cmpstr (mu_msg_contact_address (contact), + ==, "help-gnu-emacs@gnu.org"); + break; + default: + g_assert_not_reached (); + } + ++(*idx); - return TRUE; + return TRUE; } @@ -123,118 +126,118 @@ check_contact_02 (MuMsgContact *contact, int *idx) static void test_mu_msg_02 (void) { - MuMsg *msg; - int i; + MuMsg *msg; + int i; - msg = mu_msg_new_from_file (MU_TESTMAILDIR - "cur/1220863087.12663_19.mindcrime!2,S", - NULL, NULL); + msg = mu_msg_new_from_file (MU_TESTMAILDIR + "cur/1220863087.12663_19.mindcrime!2,S", + NULL, NULL); - g_assert_cmpstr (mu_msg_get_to(msg), - ==, "help-gnu-emacs@gnu.org"); - g_assert_cmpstr (mu_msg_get_subject(msg), - ==, "Re: Learning LISP; Scheme vs elisp."); - g_assert_cmpstr (mu_msg_get_from(msg), - ==, "anon@example.com"); - g_assert_cmpstr (mu_msg_get_msgid(msg), - ==, "r6bpm5-6n6.ln1@news.ducksburg.com"); - /* g_assert_cmpstr (mu_msg_get_header(msg, "Errors-To"), */ - /* ==, "help-gnu-emacs-bounces+xxxx.klub=gmail.com@gnu.org"); */ - g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ - ==, MU_MSG_PRIO_LOW); - g_assert_cmpuint (mu_msg_get_date(msg), - ==, 1218051515); + g_assert_cmpstr (mu_msg_get_to(msg), + ==, "help-gnu-emacs@gnu.org"); + g_assert_cmpstr (mu_msg_get_subject(msg), + ==, "Re: Learning LISP; Scheme vs elisp."); + g_assert_cmpstr (mu_msg_get_from(msg), + ==, "anon@example.com"); + g_assert_cmpstr (mu_msg_get_msgid(msg), + ==, "r6bpm5-6n6.ln1@news.ducksburg.com"); + g_assert_cmpstr (mu_msg_get_header(msg, "Errors-To"), + ==, "help-gnu-emacs-bounces+xxxx.klub=gmail.com@gnu.org"); + g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ + ==, MU_MSG_PRIO_LOW); + g_assert_cmpuint (mu_msg_get_date(msg), + ==, 1218051515); - i = 0; - mu_msg_contact_foreach (msg, - (MuMsgContactForeachFunc)check_contact_02, - &i); - g_assert_cmpint (i,==,2); + i = 0; + mu_msg_contact_foreach (msg, + (MuMsgContactForeachFunc)check_contact_02, + &i); + g_assert_cmpint (i,==,2); - g_assert_cmpuint (mu_msg_get_flags(msg), - ==, MU_MSG_FLAG_SEEN); + g_assert_cmpuint (mu_msg_get_flags(msg), + ==, MU_MSG_FLAG_SEEN); - mu_msg_unref (msg); + mu_msg_unref (msg); } static void test_mu_msg_03 (void) { - MuMsg *msg; + MuMsg *msg; - msg = mu_msg_new_from_file (MU_TESTMAILDIR - "cur/1283599333.1840_11.cthulhu!2,", - NULL, NULL); + msg = mu_msg_new_from_file (MU_TESTMAILDIR + "cur/1283599333.1840_11.cthulhu!2,", + NULL, NULL); - g_assert_cmpstr (mu_msg_get_to(msg), - ==, "Bilbo Baggins "); - g_assert_cmpstr (mu_msg_get_subject(msg), - ==, "Greetings from Lothlórien"); - g_assert_cmpstr (mu_msg_get_from(msg), - ==, "Frodo Baggins "); - g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ - ==, MU_MSG_PRIO_NORMAL); - g_assert_cmpuint (mu_msg_get_date(msg), - ==, 0); - g_assert_cmpstr (mu_msg_get_body_text(msg), - ==, - "\nLet's write some fünkÿ text\nusing umlauts.\n\nFoo.\n"); + g_assert_cmpstr (mu_msg_get_to(msg), + ==, "Bilbo Baggins "); + g_assert_cmpstr (mu_msg_get_subject(msg), + ==, "Greetings from Lothlórien"); + g_assert_cmpstr (mu_msg_get_from(msg), + ==, "Frodo Baggins "); + g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ + ==, MU_MSG_PRIO_NORMAL); + g_assert_cmpuint (mu_msg_get_date(msg), + ==, 0); + g_assert_cmpstr (mu_msg_get_body_text(msg), + ==, + "\nLet's write some fünkÿ text\nusing umlauts.\n\nFoo.\n"); - g_assert_cmpuint (mu_msg_get_flags(msg), - ==, MU_MSG_FLAG_UNREAD); + g_assert_cmpuint (mu_msg_get_flags(msg), + ==, MU_MSG_FLAG_UNREAD); - mu_msg_unref (msg); + mu_msg_unref (msg); } static void test_mu_msg_04 (void) { - MuMsg *msg; + MuMsg *msg; - msg = mu_msg_new_from_file (MU_TESTMAILDIR2 - "Foo/cur/mail5", NULL, NULL); + msg = mu_msg_new_from_file (MU_TESTMAILDIR2 + "Foo/cur/mail5", NULL, NULL); - g_assert_cmpstr (mu_msg_get_to(msg), - ==, "George Custer "); - g_assert_cmpstr (mu_msg_get_subject(msg), - ==, "pics for you"); - g_assert_cmpstr (mu_msg_get_from(msg), - ==, "Sitting Bull "); - g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ - ==, MU_MSG_PRIO_NORMAL); - g_assert_cmpuint (mu_msg_get_date(msg), - ==, 0); + g_assert_cmpstr (mu_msg_get_to(msg), + ==, "George Custer "); + g_assert_cmpstr (mu_msg_get_subject(msg), + ==, "pics for you"); + g_assert_cmpstr (mu_msg_get_from(msg), + ==, "Sitting Bull "); + g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ + ==, MU_MSG_PRIO_NORMAL); + g_assert_cmpuint (mu_msg_get_date(msg), + ==, 0); - g_assert_cmpuint (mu_msg_get_flags(msg), - ==, MU_MSG_FLAG_HAS_ATTACH); + g_assert_cmpuint (mu_msg_get_flags(msg), + ==, MU_MSG_FLAG_HAS_ATTACH); - mu_msg_unref (msg); + mu_msg_unref (msg); } static void test_mu_msg_05 (void) { - MuMsg *msg; + MuMsg *msg; - msg = mu_msg_new_from_file (MU_TESTMAILDIR - "cur/1305664394.2171_402.cthulhu!2,", - NULL, NULL); + msg = mu_msg_new_from_file (MU_TESTMAILDIR + "cur/1305664394.2171_402.cthulhu!2,", + NULL, NULL); - g_assert_cmpstr (mu_msg_get_to(msg), - ==, "Helmut Kröger "); - g_assert_cmpstr (mu_msg_get_subject(msg), - ==, "Motörhead"); - g_assert_cmpstr (mu_msg_get_from(msg), - ==, "Mü "); - g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ - ==, MU_MSG_PRIO_NORMAL); - g_assert_cmpuint (mu_msg_get_date(msg), - ==, 0); + g_assert_cmpstr (mu_msg_get_to(msg), + ==, "Helmut Kröger "); + g_assert_cmpstr (mu_msg_get_subject(msg), + ==, "Motörhead"); + g_assert_cmpstr (mu_msg_get_from(msg), + ==, "Mü "); + g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */ + ==, MU_MSG_PRIO_NORMAL); + g_assert_cmpuint (mu_msg_get_date(msg), + ==, 0); - mu_msg_unref (msg); + mu_msg_unref (msg); } @@ -255,27 +258,27 @@ test_mu_msg_05 (void) int main (int argc, char *argv[]) { - int rv; - g_test_init (&argc, &argv, NULL); + int rv; + g_test_init (&argc, &argv, NULL); - /* mu_msg_str_date */ - g_test_add_func ("/mu-msg/mu-msg-01", - test_mu_msg_01); - g_test_add_func ("/mu-msg/mu-msg-02", - test_mu_msg_02); - g_test_add_func ("/mu-msg/mu-msg-03", - test_mu_msg_03); - g_test_add_func ("/mu-msg/mu-msg-04", - test_mu_msg_04); - g_test_add_func ("/mu-msg/mu-msg-05", - test_mu_msg_05); + /* mu_msg_str_date */ + g_test_add_func ("/mu-msg/mu-msg-01", + test_mu_msg_01); + g_test_add_func ("/mu-msg/mu-msg-02", + test_mu_msg_02); + g_test_add_func ("/mu-msg/mu-msg-03", + test_mu_msg_03); + g_test_add_func ("/mu-msg/mu-msg-04", + test_mu_msg_04); + g_test_add_func ("/mu-msg/mu-msg-05", + test_mu_msg_05); - g_log_set_handler (NULL, - G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, - (GLogFunc)black_hole, NULL); + g_log_set_handler (NULL, + G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, + (GLogFunc)black_hole, NULL); - rv = g_test_run (); + rv = g_test_run (); - return rv; + return rv; }