mirror of https://github.com/djcb/mu.git
tests: remove obsolete tests
This commit is contained in:
parent
aa07c4a27c
commit
2d966ee2ad
|
@ -105,29 +105,6 @@ test_mu_str_prio_02 (void)
|
|||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_str_flatten (void)
|
||||
{
|
||||
int i;
|
||||
struct {
|
||||
const char* word;
|
||||
const char* norm;
|
||||
} words [] = {
|
||||
{ "dantès", "dantes"},
|
||||
{ "foo", "foo" },
|
||||
{ "Föö", "foo" },
|
||||
{ "číslo", "cislo" },
|
||||
{ "hÆvý mëÐal ümláõt", "hævy_meðal_umlaot"}
|
||||
};
|
||||
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
|
||||
gchar *str;
|
||||
str = mu_str_process_term (words[i].word);
|
||||
g_assert_cmpstr (str, ==, words[i].norm);
|
||||
g_free (str);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_parse_arglist (void)
|
||||
|
@ -154,11 +131,6 @@ test_parse_arglist (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_str_esc_to_list (void)
|
||||
{
|
||||
|
@ -186,130 +158,6 @@ test_mu_str_esc_to_list (void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_mu_str_process_query_term (void)
|
||||
{
|
||||
int i;
|
||||
struct {
|
||||
const char* word;
|
||||
const char* esc;
|
||||
} words [] = {
|
||||
{ "aap@noot.mies", "aap_noot_mies" },
|
||||
{ "Foo..Bar", "foo__bar" },
|
||||
{ "Foo.Bar", "foo_bar" },
|
||||
{ "Foo Bar", "foo_bar" },
|
||||
{ "\\foo", "_foo" },
|
||||
{ "subject:test@foo", "subject:test_foo" },
|
||||
{ "xxx:test@bar", "xxx:test_bar" },
|
||||
{ "aa$bb$cc", "aa_bb_cc" },
|
||||
{ "date:2010..2012", "date:2010..2012"},
|
||||
{ "d:2010..2012", "d:2010..2012"},
|
||||
{ "size:10..20", "size:10..20"},
|
||||
{ "x:2010..2012", "x:2010__2012"},
|
||||
{ "q:2010..2012", "q:2010__2012"},
|
||||
{ "subject:2010..2012", "subject:2010__2012"},
|
||||
{ "(maildir:foo)", "(maildir:foo)"},
|
||||
{ "Тесла, Никола", "тесла__никола"},
|
||||
{ "Masha@Аркона.ru", "masha_аркона_ru" },
|
||||
{ "foo:ελληνικά", "foo:ελληνικα" },
|
||||
{ "日本語!!", "日本語__" },
|
||||
{ "£", "_" }
|
||||
};
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
|
||||
gchar *s;
|
||||
s = mu_str_process_query_term (words[i].word);
|
||||
if (g_test_verbose())
|
||||
g_print ("expected: '%s' <=> got: '%s'\n",
|
||||
words[i].esc, s);
|
||||
g_assert_cmpstr (s, ==, words[i].esc);
|
||||
g_free (s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_mu_str_process_term (void)
|
||||
{
|
||||
int i;
|
||||
struct {
|
||||
const char* word;
|
||||
const char* esc;
|
||||
} words [] = {
|
||||
{ "aap@noot.mies", "aap_noot_mies" },
|
||||
{ "A&B", "a_b" },
|
||||
{ "Foo..Bar", "foo__bar" },
|
||||
{ "Foo.Bar", "foo_bar" },
|
||||
{ "Foo Bar", "foo_bar" },
|
||||
{ "\\foo", "_foo" },
|
||||
{ "subject:test@foo", "subject_test_foo" },
|
||||
{ "xxx:test@bar", "xxx_test_bar" },
|
||||
{ "aa$bb$cc", "aa_bb_cc" },
|
||||
{ "date:2010..2012", "date_2010__2012"},
|
||||
{ "subject:2010..2012", "subject_2010__2012"},
|
||||
{ "(maildir:foo)", "_maildir_foo_"},
|
||||
{ "Тесла, Никола", "тесла__никола"},
|
||||
{ "Masha@Аркона.ru", "masha_аркона_ru" },
|
||||
{ "foo:ελληνικά", "foo_ελληνικα" },
|
||||
{ "日本語!!", "日本語__" },
|
||||
{ "£", "_" },
|
||||
/* invalid utf8 */
|
||||
{ "Hello\xC3\x2EWorld", "hello__world" }
|
||||
};
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
|
||||
gchar *s;
|
||||
s = mu_str_process_term (words[i].word);
|
||||
if (g_test_verbose())
|
||||
g_print ("expected: '%s' <=> got: '%s'\n",
|
||||
words[i].esc, s);
|
||||
g_assert_cmpstr (s, ==, words[i].esc);
|
||||
g_free (s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_str_process_text (void)
|
||||
{
|
||||
int i;
|
||||
struct {
|
||||
const char* word;
|
||||
const char* esc;
|
||||
} words [] = {
|
||||
{ "aap@noot.mies", "aap@noot.mies" },
|
||||
{ "A&B", "a&b" },
|
||||
{ "Foo..Bar", "foo..bar" },
|
||||
{ "Foo.Bar", "foo.bar" },
|
||||
{ "Foo Bar", "foo bar" },
|
||||
{ "\\foo", "\\foo" },
|
||||
{ "subject:test@foo", "subject:test@foo" },
|
||||
{ "xxx:test@bar", "xxx:test@bar" },
|
||||
{ "aa$bb$cc", "aa$bb$cc" },
|
||||
{ "date:2010..2012", "date:2010..2012"},
|
||||
{ "subject:2010..2012", "subject:2010..2012"},
|
||||
{ "(maildir:foo)", "(maildir:foo)"},
|
||||
{ "Тесла, Никола", "тесла, никола"},
|
||||
{ "Masha@Аркона.ru", "masha@аркона.ru" },
|
||||
{ "foo:ελληνικά", "foo:ελληνικα" },
|
||||
{ "日本語!!", "日本語!!" }
|
||||
};
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
|
||||
gchar *s;
|
||||
s = mu_str_process_text (words[i].word);
|
||||
if (g_test_verbose())
|
||||
g_print ("expected: '%s' <=> got: '%s'\n",
|
||||
words[i].esc, s);
|
||||
g_assert_cmpstr (s, ==, words[i].esc);
|
||||
g_free (s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_str_display_contact (void)
|
||||
|
@ -444,38 +292,6 @@ test_mu_str_subject_normalize (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_term_fixups (void)
|
||||
{
|
||||
unsigned u;
|
||||
struct {
|
||||
const gchar *expr, *expected;
|
||||
} testcases [] = {
|
||||
{ "date:19700101", "date:19700101..19700101" },
|
||||
{ "date:19700101..19700101", "date:19700101..19700101" },
|
||||
{ "(date:20121107))", "(date:20121107..20121107))" },
|
||||
{ "maildir:/somepath", "maildir:/somepath" },
|
||||
{ "([maildir:/somepath]", "([maildir:/somepath]" },
|
||||
/* add more */
|
||||
{ "({", "({" },
|
||||
{ "({abc", "({abc" },
|
||||
{ "abc)}", "abc)}" },
|
||||
{ "", "" }
|
||||
};
|
||||
|
||||
for (u = 0; u != G_N_ELEMENTS(testcases); ++u) {
|
||||
gchar *prep;
|
||||
prep = mu_str_xapian_fixup_terms (testcases[u].expr);
|
||||
g_assert_cmpstr (prep, ==, testcases[u].expected);
|
||||
g_free (prep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_str_replace (void)
|
||||
{
|
||||
|
@ -546,16 +362,6 @@ main (int argc, char *argv[])
|
|||
g_test_add_func ("/mu-str/mu-str-prio-02",
|
||||
test_mu_str_prio_02);
|
||||
|
||||
g_test_add_func ("/mu-str/mu-str-flatten",
|
||||
test_mu_str_flatten);
|
||||
|
||||
g_test_add_func ("/mu-str/process-query-term",
|
||||
test_mu_str_process_query_term);
|
||||
g_test_add_func ("/mu-str/process-term",
|
||||
test_mu_str_process_term);
|
||||
g_test_add_func ("/mu-str/process-text",
|
||||
test_mu_str_process_text);
|
||||
|
||||
|
||||
g_test_add_func ("/mu-str/mu-str-display_contact",
|
||||
test_mu_str_display_contact);
|
||||
|
@ -579,10 +385,6 @@ main (int argc, char *argv[])
|
|||
g_test_add_func ("/mu-str/mu_str_subject_normalize",
|
||||
test_mu_str_subject_normalize);
|
||||
|
||||
/* mu_str_xapian_fixup_terms */
|
||||
g_test_add_func ("/mu-str/mu_term_fixups",
|
||||
test_mu_term_fixups);
|
||||
|
||||
g_test_add_func ("/mu-str/mu_str_remove_ctrl_in_place",
|
||||
test_mu_str_remove_ctrl_in_place);
|
||||
|
||||
|
@ -590,7 +392,8 @@ main (int argc, char *argv[])
|
|||
* function simply calls mu_msg_field_str */
|
||||
|
||||
g_log_set_handler (NULL,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL|
|
||||
G_LOG_FLAG_RECURSION,
|
||||
(GLogFunc)black_hole, NULL);
|
||||
|
||||
return g_test_run ();
|
||||
|
|
|
@ -300,13 +300,14 @@ test_mu_find_links (void)
|
|||
static void
|
||||
test_mu_find_maildir_special (void)
|
||||
{
|
||||
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);
|
||||
search ("\"maildir:/wom_bat\" subject:atoms", 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
|
||||
|
||||
/*
|
||||
** Copyright (C) 2008-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2008-2017 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** 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
|
||||
|
@ -120,17 +120,16 @@ run_and_count_matches_with_query_flags (const char *xpath, const char *query,
|
|||
mu_store_unref (store);
|
||||
|
||||
if (g_test_verbose()) {
|
||||
char *xs;
|
||||
char *x;
|
||||
g_print ("\n==> query: %s\n", query);
|
||||
xs = mu_query_preprocess (query, NULL);
|
||||
g_print ("==> preproc: '%s'\n", xs);
|
||||
g_free (xs);
|
||||
xs = mu_query_as_string (mquery, query, NULL);
|
||||
g_print ("==> xquery: '%s'\n", xs);
|
||||
g_free (xs);
|
||||
x = mu_query_internal (mquery, query, FALSE, NULL);
|
||||
g_print ("==> mquery: '%s'\n", x);
|
||||
g_free (x);
|
||||
x = mu_query_internal_xapian (mquery, query, NULL);
|
||||
g_print ("==> xquery: '%s'\n", x);
|
||||
g_free (x);
|
||||
}
|
||||
|
||||
|
||||
iter = mu_query_run (mquery, query, MU_MSG_FIELD_ID_NONE, -1,
|
||||
flags, NULL);
|
||||
mu_query_destroy (mquery);
|
||||
|
@ -384,9 +383,6 @@ test_mu_query_accented_chars_fraiche (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_query_wildcards (void)
|
||||
{
|
||||
|
@ -476,6 +472,8 @@ test_mu_query_dates_la (void)
|
|||
|
||||
QResults queries[] = {
|
||||
{ "date:20080731..20080804", 5},
|
||||
{ "date:2008-07-31..2008-08-04", 5},
|
||||
{ "date:20080804..20080731", 5},
|
||||
{ "date:20080731..20080804 s:gcc", 1},
|
||||
{ "date:200808110803..now", 6},
|
||||
{ "date:200808110803..today", 6},
|
||||
|
@ -509,7 +507,9 @@ test_mu_query_sizes (void)
|
|||
{ "size:0b..2m", 19},
|
||||
{ "size:3b..2m", 19},
|
||||
{ "size:2k..4k", 4},
|
||||
{ "size:2m..0b", 19}
|
||||
|
||||
{ "size:0b..2m", 19},
|
||||
{ "size:2m..0b", 19},
|
||||
};
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||
|
@ -595,7 +595,8 @@ test_mu_query_wom_bat (void)
|
|||
int i;
|
||||
QResults queries[] = {
|
||||
{ "maildir:/wom_bat", 3},
|
||||
{ "\"maildir:/wom bat\"", 3},
|
||||
//{ "\"maildir:/wom bat\"", 3},
|
||||
// as expected, no longer works with new parser
|
||||
};
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||
|
@ -685,26 +686,6 @@ test_mu_query_threads_compilation_error (void)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
test_mu_query_preprocess (void)
|
||||
{
|
||||
unsigned u;
|
||||
struct {
|
||||
const gchar *expr, *expected;
|
||||
} testcases [] = {
|
||||
{ "hello", "hello" },
|
||||
{ "/[Gmail].Sent Mail", "__gmail__sent mail" }
|
||||
/* add more */
|
||||
};
|
||||
|
||||
for (u = 0; u != G_N_ELEMENTS(testcases); ++u) {
|
||||
gchar *prep;
|
||||
prep = mu_query_preprocess (testcases[u].expr, NULL);
|
||||
g_assert_cmpstr (prep, ==, testcases[u].expected);
|
||||
g_free (prep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
|
@ -721,9 +702,6 @@ main (int argc, char *argv[])
|
|||
DB_PATH2 = fill_database (MU_TESTMAILDIR2);
|
||||
g_assert (DB_PATH2);
|
||||
|
||||
g_test_add_func ("/mu-query/test-mu-query-preprocess",
|
||||
test_mu_query_preprocess);
|
||||
|
||||
g_test_add_func ("/mu-query/test-mu-query-01", test_mu_query_01);
|
||||
g_test_add_func ("/mu-query/test-mu-query-02", test_mu_query_02);
|
||||
g_test_add_func ("/mu-query/test-mu-query-03", test_mu_query_03);
|
||||
|
|
Loading…
Reference in New Issue