Add unit-test for multi-to/cc recipients
To check for the report in Issue #826.
This commit is contained in:
@ -113,6 +113,7 @@ EXTRA_DIST= \
|
|||||||
testdir/cur/signed!2,S \
|
testdir/cur/signed!2,S \
|
||||||
testdir/cur/signed-encrypted!2,S \
|
testdir/cur/signed-encrypted!2,S \
|
||||||
testdir/cur/special!2,Sabc \
|
testdir/cur/special!2,Sabc \
|
||||||
|
testdir/cur/multirecip!2,S \
|
||||||
testdir2/bar/cur/mail1 \
|
testdir2/bar/cur/mail1 \
|
||||||
testdir2/bar/cur/mail2 \
|
testdir2/bar/cur/mail2 \
|
||||||
testdir2/bar/cur/mail3 \
|
testdir2/bar/cur/mail3 \
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2008-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
** 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
|
** under the terms of the GNU General Public License as published by the
|
||||||
@ -260,7 +260,7 @@ test_mu_maildir_walk_01 (void)
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
g_assert_cmpuint (MU_OK, ==, rv);
|
g_assert_cmpuint (MU_OK, ==, rv);
|
||||||
g_assert_cmpuint (data._file_count, ==, 18);
|
g_assert_cmpuint (data._file_count, ==, 19);
|
||||||
|
|
||||||
g_assert_cmpuint (data._dir_entered,==, 5);
|
g_assert_cmpuint (data._dir_entered,==, 5);
|
||||||
g_assert_cmpuint (data._dir_left,==, 5);
|
g_assert_cmpuint (data._dir_left,==, 5);
|
||||||
@ -298,7 +298,7 @@ test_mu_maildir_walk (void)
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
g_assert_cmpuint (MU_OK, ==, rv);
|
g_assert_cmpuint (MU_OK, ==, rv);
|
||||||
g_assert_cmpuint (data._file_count, ==, 14);
|
g_assert_cmpuint (data._file_count, ==, 15);
|
||||||
|
|
||||||
g_assert_cmpuint (data._dir_entered,==, 4);
|
g_assert_cmpuint (data._dir_entered,==, 4);
|
||||||
g_assert_cmpuint (data._dir_left,==, 4);
|
g_assert_cmpuint (data._dir_left,==, 4);
|
||||||
@ -330,7 +330,7 @@ test_mu_maildir_walk_with_noupdate (void)
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
g_assert_cmpuint (MU_OK, ==, rv);
|
g_assert_cmpuint (MU_OK, ==, rv);
|
||||||
g_assert_cmpuint (data._file_count, ==, 18);
|
g_assert_cmpuint (data._file_count, ==, 19);
|
||||||
g_assert_cmpuint (data._dir_entered,==, 5);
|
g_assert_cmpuint (data._dir_entered,==, 5);
|
||||||
g_assert_cmpuint (data._dir_left,==, 5);
|
g_assert_cmpuint (data._dir_left,==, 5);
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ test_mu_maildir_walk_with_noupdate (void)
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
g_assert_cmpuint (MU_OK, ==, rv);
|
g_assert_cmpuint (MU_OK, ==, rv);
|
||||||
g_assert_cmpuint (data._file_count, ==, 18);
|
g_assert_cmpuint (data._file_count, ==, 19);
|
||||||
g_assert_cmpuint (data._dir_entered,==, 5);
|
g_assert_cmpuint (data._dir_entered,==, 5);
|
||||||
g_assert_cmpuint (data._dir_left,==, 5);
|
g_assert_cmpuint (data._dir_left,==, 5);
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ test_mu_maildir_walk_with_noupdate (void)
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
g_assert_cmpuint (MU_OK, ==, rv);
|
g_assert_cmpuint (MU_OK, ==, rv);
|
||||||
g_assert_cmpuint (data._file_count, ==, 14);
|
g_assert_cmpuint (data._file_count, ==, 15);
|
||||||
|
|
||||||
g_assert_cmpuint (data._dir_entered,==, 4);
|
g_assert_cmpuint (data._dir_entered,==, 4);
|
||||||
g_assert_cmpuint (data._dir_left,==, 4);
|
g_assert_cmpuint (data._dir_left,==, 4);
|
||||||
@ -376,7 +376,7 @@ test_mu_maildir_walk_with_noupdate (void)
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
g_assert_cmpuint (MU_OK, ==, rv);
|
g_assert_cmpuint (MU_OK, ==, rv);
|
||||||
g_assert_cmpuint (data._file_count, ==, 18);
|
g_assert_cmpuint (data._file_count, ==, 19);
|
||||||
|
|
||||||
g_assert_cmpuint (data._dir_entered,==, 5);
|
g_assert_cmpuint (data._dir_entered,==, 5);
|
||||||
g_assert_cmpuint (data._dir_left,==, 5);
|
g_assert_cmpuint (data._dir_left,==, 5);
|
||||||
|
|||||||
11
lib/tests/testdir/cur/multirecip!2,S
Normal file
11
lib/tests/testdir/cur/multirecip!2,S
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Date: Thu, 15 May 2016 14:57:25 -0200
|
||||||
|
From:
|
||||||
|
To: a@example.com,b@example.com,c@example.com
|
||||||
|
Cc: d@example.com,e@example.com
|
||||||
|
Subject: test with multi to and cc
|
||||||
|
Message-id: <3BE9E652343245@emss35m06.us.lmco.com>
|
||||||
|
|
||||||
|
Message with multi cc and to.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +90,8 @@ assert_no_dups (MuMsgIter *iter)
|
|||||||
|
|
||||||
/* note: this also *moves the iter* */
|
/* note: this also *moves the iter* */
|
||||||
static guint
|
static guint
|
||||||
run_and_count_matches_with_query_flags (const char *xpath, const char *query, MuQueryFlags flags)
|
run_and_count_matches_with_query_flags (const char *xpath, const char *query,
|
||||||
|
MuQueryFlags flags)
|
||||||
{
|
{
|
||||||
MuQuery *mquery;
|
MuQuery *mquery;
|
||||||
MuMsgIter *iter;
|
MuMsgIter *iter;
|
||||||
@ -158,7 +159,8 @@ run_and_count_matches_with_query_flags (const char *xpath, const char *query, Mu
|
|||||||
static guint
|
static guint
|
||||||
run_and_count_matches (const char *xpath, const char *query)
|
run_and_count_matches (const char *xpath, const char *query)
|
||||||
{
|
{
|
||||||
return run_and_count_matches_with_query_flags (xpath, query, MU_QUERY_FLAG_NONE);
|
return run_and_count_matches_with_query_flags (
|
||||||
|
xpath, query, MU_QUERY_FLAG_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -258,9 +260,9 @@ test_mu_query_04 (void)
|
|||||||
{ "baggins", 1},
|
{ "baggins", 1},
|
||||||
{ "prio:h", 1},
|
{ "prio:h", 1},
|
||||||
{ "prio:high", 1},
|
{ "prio:high", 1},
|
||||||
{ "prio:normal", 10},
|
{ "prio:normal", 11},
|
||||||
{ "prio:l", 7},
|
{ "prio:l", 7},
|
||||||
{ "not prio:l", 11},
|
{ "not prio:l", 12},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||||
@ -416,7 +418,7 @@ test_mu_query_dates_helsinki (void)
|
|||||||
{ "date:20080731..20080804", 5},
|
{ "date:20080731..20080804", 5},
|
||||||
{ "date:20080731..20080804 s:gcc", 1},
|
{ "date:20080731..20080804 s:gcc", 1},
|
||||||
{ "date:200808110803..now", 6},
|
{ "date:200808110803..now", 6},
|
||||||
{ "date:200808110803..today", 6},
|
{ "date:200808110803..today",7},
|
||||||
{ "date:200808110801..now", 6}
|
{ "date:200808110801..now", 6}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -476,7 +478,7 @@ test_mu_query_dates_la (void)
|
|||||||
{ "date:20080731..20080804", 5},
|
{ "date:20080731..20080804", 5},
|
||||||
{ "date:20080731..20080804 s:gcc", 1},
|
{ "date:20080731..20080804 s:gcc", 1},
|
||||||
{ "date:200808110803..now", 5},
|
{ "date:200808110803..now", 5},
|
||||||
{ "date:200808110803..today", 5},
|
{ "date:200808110803..today", 6},
|
||||||
{ "date:200808110801..now", 5}
|
{ "date:200808110801..now", 5}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -502,9 +504,9 @@ test_mu_query_sizes (void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
QResults queries[] = {
|
QResults queries[] = {
|
||||||
{ "size:0b..2m", 18},
|
{ "size:0b..2m", 19},
|
||||||
{ "size:2k..4k", 4},
|
{ "size:2k..4k", 4},
|
||||||
{ "size:2m..0b", 18}
|
{ "size:2m..0b", 19}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||||
@ -617,6 +619,24 @@ test_mu_query_signed_encrypted (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_mu_query_multi_to_cc (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
QResults queries[] = {
|
||||||
|
{ "to:a@example.com", 1},
|
||||||
|
{ "cc:d@example.com", 1},
|
||||||
|
{ "to:b@example.com", 1},
|
||||||
|
{ "cc:e@example.com", 1},
|
||||||
|
{ "cc:e@example.com AND cc:d@example.com", 1},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
|
||||||
|
g_assert_cmpuint (run_and_count_matches (DB_PATH1,
|
||||||
|
queries[i].query),
|
||||||
|
==, queries[i].count);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_mu_query_tags_02 (void)
|
test_mu_query_tags_02 (void)
|
||||||
{
|
{
|
||||||
@ -708,7 +728,8 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
g_test_add_func ("/mu-query/test-mu-query-signed-encrypted",
|
g_test_add_func ("/mu-query/test-mu-query-signed-encrypted",
|
||||||
test_mu_query_signed_encrypted);
|
test_mu_query_signed_encrypted);
|
||||||
|
g_test_add_func ("/mu-query/test-mu-query-multi-to-cc",
|
||||||
|
test_mu_query_multi_to_cc);
|
||||||
g_test_add_func ("/mu-query/test-mu-query-logic", test_mu_query_logic);
|
g_test_add_func ("/mu-query/test-mu-query-logic", test_mu_query_logic);
|
||||||
|
|
||||||
g_test_add_func ("/mu-query/test-mu-query-accented-chars-1",
|
g_test_add_func ("/mu-query/test-mu-query-accented-chars-1",
|
||||||
|
|||||||
Reference in New Issue
Block a user