tests: update test helpers and users

Move test-mu-common to mu-test-utils. Use mu_test_init as a wrapper for
g_test_init. Update users.
This commit is contained in:
Dirk-Jan C. Binnema
2022-08-10 08:20:58 +03:00
parent 84cd6942c4
commit 317fe53ff7
33 changed files with 355 additions and 406 deletions

View File

@ -80,7 +80,7 @@ Mu::lowercase_hash(const std::string& s)
*
*/
#include "utils/mu-utils.hh"
#include "utils/mu-test-utils.hh"
static void
test_ctor_foo()
@ -189,14 +189,13 @@ static void
test_misc()
{
g_assert_false(!!contact_type_from_field_id(Field::Id::Subject));
}
int
main(int argc, char* argv[])
{
g_test_init(&argc, &argv, NULL);
mu_test_init(&argc, &argv);
g_mime_init();
g_test_add_func("/message/contact/ctor-foo", test_ctor_foo);

View File

@ -370,6 +370,8 @@ Document::remove(Field::Id field_id)
#ifdef BUILD_TESTS
#include "utils/mu-test-utils.hh"
#define assert_same_contact(C1,C2) do { \
g_assert_cmpstr(C1.email.c_str(),==,C2.email.c_str()); \
g_assert_cmpstr(C2.name.c_str(),==,C2.name.c_str()); \

View File

@ -20,6 +20,8 @@
#include "mu-fields.hh"
#include "mu-flags.hh"
#include "utils/mu-test-utils.hh"
using namespace Mu;
std::string
@ -184,7 +186,7 @@ test_xapian_term()
int
main(int argc, char* argv[])
{
g_test_init(&argc, &argv, NULL);
mu_test_init(&argc, &argv);
g_test_add_func("/message/fields/ids", test_ids);
g_test_add_func("/message/fields/shortcuts", test_shortcuts);

View File

@ -122,6 +122,8 @@ Mu::flags_from_path(const std::string& path)
#ifdef BUILD_TESTS
#include "utils/mu-test-utils.hh"
static void
test_maildir_from_path()
{
@ -192,7 +194,7 @@ test_flags_from_path()
int
main(int argc, char* argv[])
{
g_test_init(&argc, &argv, NULL);
mu_test_init(&argc, &argv);
g_test_add_func("/message/file/maildir-from-path",
test_maildir_from_path);

View File

@ -16,7 +16,7 @@
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**
*/
#include "utils/mu-test-utils.hh"
#include "mu-message.hh"
#include "mu-mime-object.hh"
#include <glib.h>
@ -834,7 +834,7 @@ test_message_sanitize_maildir()
int
main(int argc, char* argv[])
{
g_test_init(&argc, &argv, NULL);
mu_test_init(&argc, &argv);
g_test_add_func("/message/message/mailing-list",
test_message_mailing_list);