tests: add unit test for cjk handling
This test exposes some problem finding longer CJK strings; see: issue #1428. The test does not _pass_ yet, so skip it for now.
This commit is contained in:
@ -559,6 +559,43 @@ test_mu_query_threads_compilation_error(void)
|
||||
3);
|
||||
}
|
||||
|
||||
/* https://github.com/djcb/mu/issues/1428 */
|
||||
static void
|
||||
test_mu_query_cjk(void)
|
||||
{
|
||||
/* XXX: this doesn't pass yet; return for now */
|
||||
g_test_skip("skip CJK tests");
|
||||
return;
|
||||
|
||||
{
|
||||
g_unsetenv("XAPIAN_CJK_NGRAM");
|
||||
const auto xpath = make_database(MU_TESTMAILDIR_CJK);
|
||||
g_assert_cmpuint(run_and_count_matches(xpath,
|
||||
"サーバがダウンしました",
|
||||
QueryFlags::None),
|
||||
==, 1);
|
||||
g_assert_cmpuint(run_and_count_matches(xpath,
|
||||
"サーバ",
|
||||
QueryFlags::None),
|
||||
==, 0);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
g_setenv("XAPIAN_CJK_NGRAM", "1", TRUE);
|
||||
const auto xpath = make_database(MU_TESTMAILDIR_CJK);
|
||||
g_assert_cmpuint(run_and_count_matches(xpath,
|
||||
"サーバがダウンしました",
|
||||
QueryFlags::None),
|
||||
==, 0);
|
||||
g_assert_cmpuint(run_and_count_matches(xpath,
|
||||
"サーバ",
|
||||
QueryFlags::None),
|
||||
==, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
@ -608,6 +645,9 @@ main(int argc, char* argv[])
|
||||
g_test_add_func("/mu-query/test-mu-query-threads-compilation-error",
|
||||
test_mu_query_threads_compilation_error);
|
||||
|
||||
g_test_add_func("/mu-query/test-mu-query-cjk",
|
||||
test_mu_query_cjk);
|
||||
|
||||
if (!g_test_verbose())
|
||||
g_log_set_handler(NULL,
|
||||
(GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
|
||||
|
||||
Reference in New Issue
Block a user