From f00f1dc01b8854909066769f686840cc8b30920d Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 6 Jan 2011 13:14:17 +0200 Subject: [PATCH] * add test case for mu view --- src/tests/Makefile.am | 3 ++- src/tests/test-mu-cmd.c | 30 ++++++++++++++++++--- src/tests/test-mu-msg.c | 2 +- src/tests/test-mu-util.c | 2 +- src/tests/testdir2/Foo/cur/{mail4 => mail5} | 0 src/tests/testdir2/bar/cur/mail4 | 28 +++++++++++++++++++ 6 files changed, 58 insertions(+), 7 deletions(-) rename src/tests/testdir2/Foo/cur/{mail4 => mail5} (100%) create mode 100644 src/tests/testdir2/bar/cur/mail4 diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 967fa7e0..1a770cbf 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -103,5 +103,6 @@ EXTRA_DIST= \ testdir2/bar/cur/mail1 \ testdir2/bar/cur/mail2 \ testdir2/bar/cur/mail3 \ - testdir2/Foo/cur/mail4 + testdir2/bar/cur/mail4 \ + testdir2/Foo/cur/mail5 diff --git a/src/tests/test-mu-cmd.c b/src/tests/test-mu-cmd.c index a4c95a1b..1ee4eb57 100644 --- a/src/tests/test-mu-cmd.c +++ b/src/tests/test-mu-cmd.c @@ -115,7 +115,7 @@ test_mu_index (void) store = mu_store_new (xpath, 0, NULL); g_assert (store); - g_assert_cmpuint (mu_store_count (store), ==, 4); + g_assert_cmpuint (mu_store_count (store), ==, 5); mu_store_destroy (store); g_free (muhome); @@ -197,7 +197,7 @@ test_mu_extract_01 (void) { gchar *cmdline, *output, *erroutput; - cmdline = g_strdup_printf ("%s extract %s%cFoo%ccur%cmail4", + cmdline = g_strdup_printf ("%s extract %s%cFoo%ccur%cmail5", MU_PROGRAM, MU_TESTMAILDIR2, G_DIR_SEPARATOR, @@ -248,7 +248,7 @@ test_mu_extract_02 (void) g_assert (g_mkdir_with_parents (tmpdir, 0700) == 0); - cmdline = g_strdup_printf ("%s extract -a --target-dir=%s %s%cFoo%ccur%cmail4", + cmdline = g_strdup_printf ("%s extract -a --target-dir=%s %s%cFoo%ccur%cmail5", MU_PROGRAM, tmpdir, MU_TESTMAILDIR2, @@ -285,7 +285,7 @@ test_mu_extract_03 (void) g_assert (g_mkdir_with_parents (tmpdir, 0700) == 0); cmdline = g_strdup_printf ("%s extract --parts 3 " - "--target-dir=%s %s%cFoo%ccur%cmail4", + "--target-dir=%s %s%cFoo%ccur%cmail5", MU_PROGRAM, tmpdir, MU_TESTMAILDIR2, @@ -310,6 +310,27 @@ test_mu_extract_03 (void) } +static void +test_mu_view_01 (void) +{ + gchar *cmdline, *output; + + cmdline = g_strdup_printf ("%s view %s%cbar%ccur%cmail4", + MU_PROGRAM, + MU_TESTMAILDIR2, + G_DIR_SEPARATOR, + G_DIR_SEPARATOR, + G_DIR_SEPARATOR); + output = NULL; + g_assert (g_spawn_command_line_sync (cmdline, &output, NULL, NULL, NULL)); + g_assert_cmpstr (output, !=, NULL); + + /* not, this will break if/when decoding is fixed */ + g_assert_cmpuint (strlen(output), ==, 370); + + g_free (output); + g_free (cmdline); +} int @@ -326,6 +347,7 @@ main (int argc, char *argv[]) g_test_add_func ("/mu-cmd/test-mu-extract-01", test_mu_extract_01); g_test_add_func ("/mu-cmd/test-mu-extract-02", test_mu_extract_02); g_test_add_func ("/mu-cmd/test-mu-extract-03", test_mu_extract_03); + g_test_add_func ("/mu-cmd/test-mu-view-01", test_mu_view_01); g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, diff --git a/src/tests/test-mu-msg.c b/src/tests/test-mu-msg.c index 984bc263..9435e0f5 100644 --- a/src/tests/test-mu-msg.c +++ b/src/tests/test-mu-msg.c @@ -195,7 +195,7 @@ test_mu_msg_04 (void) MuMsg *msg; msg = mu_msg_new (MU_TESTMAILDIR2 - "Foo/cur/mail4", NULL, NULL); + "Foo/cur/mail5", NULL, NULL); g_assert_cmpstr (mu_msg_get_to(msg), ==, "George Custer "); diff --git a/src/tests/test-mu-util.c b/src/tests/test-mu-util.c index e13d47af..84b44e2c 100644 --- a/src/tests/test-mu-util.c +++ b/src/tests/test-mu-util.c @@ -221,7 +221,7 @@ test_mu_util_get_dtype_with_lstat (void) g_assert_cmpuint ( mu_util_get_dtype_with_lstat (MU_TESTMAILDIR2), ==, DT_DIR); g_assert_cmpuint ( - mu_util_get_dtype_with_lstat (MU_TESTMAILDIR2 "Foo/cur/mail4"), + mu_util_get_dtype_with_lstat (MU_TESTMAILDIR2 "Foo/cur/mail5"), ==, DT_REG); } diff --git a/src/tests/testdir2/Foo/cur/mail4 b/src/tests/testdir2/Foo/cur/mail5 similarity index 100% rename from src/tests/testdir2/Foo/cur/mail4 rename to src/tests/testdir2/Foo/cur/mail5 diff --git a/src/tests/testdir2/bar/cur/mail4 b/src/tests/testdir2/bar/cur/mail4 new file mode 100644 index 00000000..1f160892 --- /dev/null +++ b/src/tests/testdir2/bar/cur/mail4 @@ -0,0 +1,28 @@ +Return-Path: +Delivered-To: foo@example.com +Received: from [128.88.204.56] by freemailng0304.web.de with HTTP; + Mon, 07 May 2005 00:27:52 +0200 +Date: Mon, 07 May 2005 00:27:52 +0200 +Message-Id: <293847329847@web.de> +MIME-Version: 1.0 +From: =?iso-8859-1?Q? "=F6tzi" ?= +To: foo@example.com +Subject: =?iso-8859-1?Q?Re:=20der=20b=E4r=20und=20das=20m=E4dchen?= +Precedence: fm-user +Organization: http://freemail.web.de/ +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: 8bit +X-MIME-Autoconverted: from quoted-printable to 8bit by mailhost6.ladot.com id j48MScQ30791 +X-UIDL: 93h!!\i