summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordjcb <djcb@localhost.localdomain>2011-11-27 16:19:50 +0200
committerdjcb <djcb@localhost.localdomain>2011-11-27 16:19:50 +0200
commitab4ef80ecbdf25ee4ec2bf48bcaaae789d5647bb (patch)
tree9f206cb96f4a4affa1bd2ba14e5d9bf1165ffebf /src
parent30bfeb2f6cf5a2dda7367ed408fc07c2a2500ab4 (diff)
* update test cases
Diffstat (limited to 'src')
-rw-r--r--src/tests/test-mu-cmd.c78
-rw-r--r--src/tests/testdir2/wom bat/cur/rfc822.1 (renamed from src/tests/testdir2/wom bat/cur/rfc822)0
-rw-r--r--src/tests/testdir2/wom bat/cur/rfc822.244
3 files changed, 117 insertions, 5 deletions
diff --git a/src/tests/test-mu-cmd.c b/src/tests/test-mu-cmd.c
index eb75029..4f4af95 100644
--- a/src/tests/test-mu-cmd.c
+++ b/src/tests/test-mu-cmd.c
@@ -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);
diff --git a/src/tests/testdir2/wom bat/cur/rfc822 b/src/tests/testdir2/wom bat/cur/rfc822.1
index 71c3107..71c3107 100644
--- a/src/tests/testdir2/wom bat/cur/rfc822
+++ b/src/tests/testdir2/wom bat/cur/rfc822.1
diff --git a/src/tests/testdir2/wom bat/cur/rfc822.2 b/src/tests/testdir2/wom bat/cur/rfc822.2
new file mode 100644
index 0000000..316fa3f
--- /dev/null
+++ b/src/tests/testdir2/wom bat/cur/rfc822.2
@@ -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!
+
+--=-=-=--