* add optional separator (\f, form-feed) between multiple messages in 'mu

view' when using --separate (fixes issue #41)
This commit is contained in:
Dirk-Jan C. Binnema
2011-06-14 00:08:13 +03:00
parent d2d791998f
commit 57ebeda135
7 changed files with 141 additions and 19 deletions

View File

@ -115,6 +115,7 @@ EXTRA_DIST= \
testdir2/bar/cur/mail2 \
testdir2/bar/cur/mail3 \
testdir2/bar/cur/mail4 \
testdir2/bar/cur/mail5 \
testdir2/Foo/cur/mail5 \
testdir2/Foo/cur/arto.eml

View File

@ -115,7 +115,7 @@ test_mu_index (void)
store = mu_store_new (xpath, NULL, NULL);
g_assert (store);
g_assert_cmpuint (mu_store_count (store), ==, 6);
g_assert_cmpuint (mu_store_count (store), ==, 7);
mu_store_destroy (store);
g_free (muhome);
@ -453,6 +453,81 @@ test_mu_view_01 (void)
}
static void
test_mu_view_multi (void)
{
gchar *cmdline, *output, *tmpdir;
int len;
tmpdir = test_mu_common_get_random_tmpdir();
g_assert (g_mkdir_with_parents (tmpdir, 0700) == 0);
cmdline = g_strdup_printf ("%s view --muhome=%s "
"%s%cbar%ccur%cmail5 "
"%s%cbar%ccur%cmail5",
MU_PROGRAM,
tmpdir,
MU_TESTMAILDIR2,
G_DIR_SEPARATOR,
G_DIR_SEPARATOR,
G_DIR_SEPARATOR,
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);
len = strlen(output);
/* g_print ("\n[%s](%u)\n", output, len); */
g_assert_cmpuint (len,==,164);
g_free (output);
g_free (cmdline);
g_free (tmpdir);
}
static void
test_mu_view_multi_separate (void)
{
gchar *cmdline, *output, *tmpdir;
int len;
tmpdir = test_mu_common_get_random_tmpdir();
g_assert (g_mkdir_with_parents (tmpdir, 0700) == 0);
cmdline = g_strdup_printf ("%s view --separate --muhome=%s "
"%s%cbar%ccur%cmail5 "
"%s%cbar%ccur%cmail5",
MU_PROGRAM,
tmpdir,
MU_TESTMAILDIR2,
G_DIR_SEPARATOR,
G_DIR_SEPARATOR,
G_DIR_SEPARATOR,
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);
len = strlen(output);
/* g_print ("\n[%s](%u)\n", output, len); */
g_assert_cmpuint (len,==,165);
g_free (output);
g_free (cmdline);
g_free (tmpdir);
}
static void
test_mu_view_attach (void)
{
@ -546,9 +621,11 @@ main (int argc, char *argv[])
test_mu_extract_by_name);
g_test_add_func ("/mu-cmd/test-mu-view-01", test_mu_view_01);
g_test_add_func ("/mu-cmd/test-mu-view-multi",
test_mu_view_multi);
g_test_add_func ("/mu-cmd/test-mu-view-multi-separate",
test_mu_view_multi_separate);
g_test_add_func ("/mu-cmd/test-mu-view-attach", test_mu_view_attach);
g_test_add_func ("/mu-cmd/test-mu-mkdir-01", test_mu_mkdir_01);
g_log_set_handler (NULL,

View File

@ -0,0 +1,7 @@
Date: Mon, 13 Jun 2011 14:57:25 -0400
From: xyz@123.xx
Subject: abc
To: foo@bar.cx
Message-id: <abc@def>
123