* update test cases

This commit is contained in:
djcb 2011-11-27 16:19:50 +02:00
parent 30bfeb2f6c
commit ab4ef80ecb
3 changed files with 117 additions and 5 deletions

View File

@ -90,8 +90,12 @@ search (const char* query, unsigned expected)
g_assert (g_spawn_command_line_sync (cmdline,
&output, &erroutput,
NULL, NULL));
if (g_test_verbose())
g_print ("\nOutput:\n%s", output);
g_assert_cmpuint (newlines_in_output(output),==,expected);
/* we expect zero lines of error output if there is a match;
* otherwise there should be one line 'No matches found' */
/* g_assert_cmpuint (newlines_in_output(erroutput),==, */
@ -118,7 +122,7 @@ test_mu_index (void)
store = mu_store_new_read_only (xpath, NULL);
g_assert (store);
g_assert_cmpuint (mu_store_count (store, NULL), ==, 11);
g_assert_cmpuint (mu_store_count (store, NULL), ==, 12);
mu_store_unref (store);
g_free (muhome);
@ -126,7 +130,15 @@ test_mu_index (void)
}
/* index testdir2, and make sure it adds two documents */
static void
test_mu_find_empty_query (void)
{
search ("\"\"", 12);
}
static void
test_mu_find_01 (void)
{
@ -157,6 +169,36 @@ test_mu_find_02 (void)
}
static void
test_mu_find_file (void)
{
search ("file:sittingbull.jpg", 1);
search ("file:custer.jpg", 1);
search ("file:custer.*", 1);
search ("j:sit*", 1);
}
static void
test_mu_find_mime (void)
{
search ("mime:image/jpeg", 1);
search ("mime:text/plain", 12);
search ("y:text*", 12);
search ("y:image*", 1);
search ("mime:message/rfc822", 2);
}
static void
test_mu_find_text_in_rfc822 (void)
{
}
/* some more tests */
static void
test_mu_find_03 (void)
@ -197,14 +239,30 @@ test_mu_find_04 (void)
/* some more tests */
static void
test_mu_find_05 (void)
test_mu_find_maildir_special (void)
{
/* ensure that maldirs with spaces in their names work... */
search ("subject:atoms", 1);
search ("\"maildir:/wom bat\" subject:atoms", 1);
search ("\"maildir:/wOm_bàT\"", 3);
search ("\"maildir:/wOm*\"", 3);
search ("\"maildir:/wOm *\"", 3);
search ("\"maildir:wom bat\"", 0);
search ("\"maildir:/wombat\"", 0);
search ("subject:atoms", 1);
}
/* static void */
/* test_mu_find_mime_types (void) */
/* { */
/* /\* ensure that maldirs with spaces in their names work... *\/ */
/* search ("\"maildir:/wom bat\" subject:atoms", 1); */
/* search ("\"maildir:/wOm_bàT\"", 3); */
/* search ("subject:atoms", 1); */
/* } */
static void
test_mu_extract_01 (void)
@ -622,11 +680,21 @@ main (int argc, char *argv[])
setenv ("LC_ALL", "en_US.utf8", 1);
g_test_add_func ("/mu-cmd/test-mu-index", test_mu_index);
g_test_add_func ("/mu-cmd/test-mu-find-empty-query",
test_mu_find_empty_query);
g_test_add_func ("/mu-cmd/test-mu-find-01", test_mu_find_01);
g_test_add_func ("/mu-cmd/test-mu-find-02", test_mu_find_02);
g_test_add_func ("/mu-cmd/test-mu-find-file", test_mu_find_file);
g_test_add_func ("/mu-cmd/test-mu-find-mime", test_mu_find_mime);
g_test_add_func ("/mu-cmd/test-mu-find-text-in-rfc822",
test_mu_find_text_in_rfc822);
g_test_add_func ("/mu-cmd/test-mu-find-03", test_mu_find_03);
g_test_add_func ("/mu-cmd/test-mu-find-04", test_mu_find_04);
g_test_add_func ("/mu-cmd/test-mu-find-05", test_mu_find_05);
g_test_add_func ("/mu-cmd/test-mu-find-maildir-special",
test_mu_find_maildir_special);
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);

View File

@ -0,0 +1,44 @@
From: dwarf@siblings.net
To: root@eruditorum.org
Subject: Fwd: test abc
References: <8639ddr9wu.fsf@cthulhu.djcbsoftware>
User-agent: mu 0.98pre; emacs 24.0.91.9
Date: Thu, 24 Nov 2011 14:24:00 +0200
Message-ID: <861usxr9nj.fsf@cthulhu.djcbsoftware>
Content-Type: multipart/mixed; boundary="=-=-="
MIME-Version: 1.0
--=-=-=
Content-Type: text/plain
Saw the website. Am willing to stipulate that you are not RIST 9E03. Suspect
that you are the Dentist, who yearns for honest exchange of views. Anonymous,
digitally signed e-mail is the only safe vehicle for same.
If you want me to believe you are not the Dentist, provide plausible
explanation for your question regarding why we are building the Crypt.
Yours truly,
--=-=-=
Content-Type: message/rfc822
Content-Disposition: inline; filename=
"1322137188_3.11919.foo:2,S"
Content-Description: rfc822
From: dwarf@siblings.net
To: root@eruditorum.org
Subject: test abc
User-agent: mu 0.98pre; emacs 24.0.91.9
Date: Thu, 24 Nov 2011 14:18:25 +0200
Message-ID: <8639ddr9wu.fsf@cthulhu.djcbsoftware>
Content-Type: text/plain
MIME-Version: 1.0
As I stepped on this unknown middle-aged Filipina's feet during an ill-advised
ballroom dancing foray, she leaned close to me and uttered some latitude and
longitude figures with a conspicuously large number of significant digits of
precision, implying a maximum positional error on the order of the size of a
dinner plate. Gosh, was I ever curious!
--=-=-=--