tests: update for mu-message-fields
This commit is contained in:
@ -18,16 +18,43 @@
|
||||
# tests
|
||||
#
|
||||
|
||||
|
||||
test('test-message-flags',
|
||||
executable('test-message-flags',
|
||||
'../mu-message-flags.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
test('test-message-priority',
|
||||
executable('test-message-priority',
|
||||
'../mu-message-priority.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
test('test-message-fields',
|
||||
executable('test-message-fields',
|
||||
'../mu-message-fields.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
test('test-message-contact',
|
||||
executable('test-message-contact',
|
||||
'../mu-message-contact.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
test('test-maildir',
|
||||
executable('test-maildir',
|
||||
'test-mu-maildir.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test-msg-fields',
|
||||
executable('test-msg-fields',
|
||||
'test-mu-msg-fields.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
test('test-msg',
|
||||
executable('test-msg',
|
||||
'test-mu-msg.cc',
|
||||
@ -62,31 +89,6 @@ test('test-contacts-cache',
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
|
||||
test('test-message-contact',
|
||||
executable('test-message-contact',
|
||||
'../mu-message-contact.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
|
||||
test('test-message-flags',
|
||||
executable('test-message-flags',
|
||||
'../mu-message-flags.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
test('test-message-priority',
|
||||
executable('test-message-priority',
|
||||
'../mu-message-priority.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
|
||||
test('test-parser',
|
||||
executable('test-parser',
|
||||
'test-parser.cc',
|
||||
|
||||
@ -29,14 +29,14 @@
|
||||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.hh"
|
||||
#include "mu-msg-fields.h"
|
||||
#include "mu-message-fields.hh"
|
||||
|
||||
static void
|
||||
test_mu_msg_field_body(void)
|
||||
{
|
||||
MuMsgFieldId field;
|
||||
Field::Id field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_BODY_TEXT;
|
||||
field = Field::Id::BodyText;
|
||||
|
||||
g_assert_cmpstr(mu_msg_field_name(field), ==, "body");
|
||||
g_assert_cmpuint(mu_msg_field_shortcut(field), ==, 'b');
|
||||
@ -48,9 +48,9 @@ test_mu_msg_field_body(void)
|
||||
static void
|
||||
test_mu_msg_field_subject(void)
|
||||
{
|
||||
MuMsgFieldId field;
|
||||
Field::Id field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_SUBJECT;
|
||||
field = Field::Id::Subject;
|
||||
|
||||
g_assert_cmpstr(mu_msg_field_name(field), ==, "subject");
|
||||
g_assert_cmpuint(mu_msg_field_shortcut(field), ==, 's');
|
||||
@ -62,9 +62,9 @@ test_mu_msg_field_subject(void)
|
||||
static void
|
||||
test_mu_msg_field_to(void)
|
||||
{
|
||||
MuMsgFieldId field;
|
||||
Field::Id field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_TO;
|
||||
field = Field::Id::To;
|
||||
|
||||
g_assert_cmpstr(mu_msg_field_name(field), ==, "to");
|
||||
g_assert_cmpuint(mu_msg_field_shortcut(field), ==, 't');
|
||||
@ -76,9 +76,9 @@ test_mu_msg_field_to(void)
|
||||
static void
|
||||
test_mu_msg_field_prio(void)
|
||||
{
|
||||
MuMsgFieldId field;
|
||||
Field::Id field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_PRIO;
|
||||
field = Field::Id::Priority;
|
||||
|
||||
g_assert_cmpstr(mu_msg_field_name(field), ==, "prio");
|
||||
g_assert_cmpuint(mu_msg_field_shortcut(field), ==, 'p');
|
||||
@ -90,9 +90,9 @@ test_mu_msg_field_prio(void)
|
||||
static void
|
||||
test_mu_msg_field_flags(void)
|
||||
{
|
||||
MuMsgFieldId field;
|
||||
Field::Id field;
|
||||
|
||||
field = MU_MSG_FIELD_ID_FLAGS;
|
||||
field = Field::Id::Flags;
|
||||
|
||||
g_assert_cmpstr(mu_msg_field_name(field), ==, "flag");
|
||||
g_assert_cmpuint(mu_msg_field_shortcut(field), ==, 'g');
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 2008-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2008-2022 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
|
||||
@ -63,8 +63,8 @@ test_store_add_count_remove()
|
||||
g_assert_true(store.contains_message(MuTestMaildir + "/cur/1283599333.1840_11.cthulhu!2,"));
|
||||
|
||||
g_assert_cmpuint(store.add_message(MuTestMaildir2 + "/bar/cur/mail3"),
|
||||
!=,
|
||||
Mu::Store::InvalidId);
|
||||
!=,
|
||||
Mu::Store::InvalidId);
|
||||
|
||||
g_assert_cmpuint(store.size(), ==, 2);
|
||||
g_assert_true(store.contains_message(MuTestMaildir2 + "/bar/cur/mail3"));
|
||||
@ -94,8 +94,8 @@ test_store_add_count_remove_in_memory()
|
||||
g_assert_true(store.contains_message(MuTestMaildir + "/cur/1283599333.1840_11.cthulhu!2,"));
|
||||
|
||||
g_assert_cmpuint(store.add_message(MuTestMaildir2 + "/bar/cur/mail3"),
|
||||
!=,
|
||||
Mu::Store::InvalidId);
|
||||
!=,
|
||||
Mu::Store::InvalidId);
|
||||
|
||||
g_assert_cmpuint(store.size(), ==, 2);
|
||||
g_assert_true(store.contains_message(MuTestMaildir2 + "/bar/cur/mail3"));
|
||||
@ -121,9 +121,9 @@ main(int argc, char* argv[])
|
||||
g_test_add_func("/store/in-memory/add-count-remove", test_store_add_count_remove_in_memory);
|
||||
|
||||
// if (!g_test_verbose())
|
||||
// g_log_set_handler (NULL,
|
||||
// G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||
// (GLogFunc)black_hole, NULL);
|
||||
// g_log_set_handler (NULL,
|
||||
// G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||
// (GLogFunc)black_hole, NULL);
|
||||
|
||||
return g_test_run();
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "test-mu-common.hh"
|
||||
|
||||
using namespace Mu;
|
||||
using namespace Mu::Message;
|
||||
|
||||
static void
|
||||
test_query()
|
||||
@ -54,22 +55,22 @@ test_query()
|
||||
size_t n{};
|
||||
for (auto&& item : res)
|
||||
g_debug("%02zu %s %s",
|
||||
++n,
|
||||
item.path().value_or("<none>").c_str(),
|
||||
item.message_id().value_or("<none>").c_str());
|
||||
++n,
|
||||
item.path().value_or("<none>").c_str(),
|
||||
item.message_id().value_or("<none>").c_str());
|
||||
};
|
||||
|
||||
g_assert_cmpuint(store.size(), ==, 19);
|
||||
|
||||
{
|
||||
const auto res = store.run_query("", MU_MSG_FIELD_ID_NONE, QueryFlags::None);
|
||||
const auto res = store.run_query("", {}, QueryFlags::None);
|
||||
g_assert_true(!!res);
|
||||
g_assert_cmpuint(res->size(), ==, 19);
|
||||
dump_matches(*res);
|
||||
}
|
||||
|
||||
{
|
||||
const auto res = store.run_query("", MU_MSG_FIELD_ID_PATH, QueryFlags::None, 11);
|
||||
const auto res = store.run_query("", Field::Id::Path, QueryFlags::None, 11);
|
||||
g_assert_true(!!res);
|
||||
g_assert_cmpuint(res->size(), ==, 11);
|
||||
dump_matches(*res);
|
||||
|
||||
Reference in New Issue
Block a user