tests: avoid build warning
Check all the functions that return a Result.
This commit is contained in:
@ -440,8 +440,8 @@ test_mu_contacts_cache_personal()
|
|||||||
{
|
{
|
||||||
MemDb xdb{};
|
MemDb xdb{};
|
||||||
Config cdb{xdb};
|
Config cdb{xdb};
|
||||||
cdb.set<Config::Id::PersonalAddresses>
|
assert_valid_result(cdb.set<Config::Id::PersonalAddresses>
|
||||||
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}});
|
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}}));
|
||||||
ContactsCache contacts{cdb};
|
ContactsCache contacts{cdb};
|
||||||
|
|
||||||
g_assert_true(contacts.is_personal("foo@example.com"));
|
g_assert_true(contacts.is_personal("foo@example.com"));
|
||||||
@ -460,8 +460,8 @@ test_mu_contacts_cache_ignored()
|
|||||||
{
|
{
|
||||||
MemDb xdb{};
|
MemDb xdb{};
|
||||||
Config cdb{xdb};
|
Config cdb{xdb};
|
||||||
cdb.set<Config::Id::IgnoredAddresses>
|
assert_valid_result(cdb.set<Config::Id::IgnoredAddresses>
|
||||||
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}});
|
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}}));
|
||||||
ContactsCache contacts{cdb};
|
ContactsCache contacts{cdb};
|
||||||
|
|
||||||
g_assert_true(contacts.is_ignored("foo@example.com"));
|
g_assert_true(contacts.is_ignored("foo@example.com"));
|
||||||
@ -500,7 +500,7 @@ test_mu_contacts_cache_foreach()
|
|||||||
size_t n{};
|
size_t n{};
|
||||||
g_assert_false(ccache.empty());
|
g_assert_false(ccache.empty());
|
||||||
g_assert_cmpuint(ccache.size(),==,2);
|
g_assert_cmpuint(ccache.size(),==,2);
|
||||||
ccache.for_each([&](auto&& contact) { ++n; return false; });
|
assert_valid_result(ccache.for_each([&](auto&& contact) { ++n; return false; }));
|
||||||
g_assert_cmpuint(n,==,1);
|
g_assert_cmpuint(n,==,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ test_mu_contacts_cache_foreach()
|
|||||||
size_t n{};
|
size_t n{};
|
||||||
g_assert_false(ccache.empty());
|
g_assert_false(ccache.empty());
|
||||||
g_assert_cmpuint(ccache.size(),==,2);
|
g_assert_cmpuint(ccache.size(),==,2);
|
||||||
ccache.for_each([&](auto&& contact) { ++n; return true; });
|
assert_valid_result(ccache.for_each([&](auto&& contact) { ++n; return true; }));
|
||||||
g_assert_cmpuint(n,==,2);
|
g_assert_cmpuint(n,==,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ test_mu_contacts_cache_foreach()
|
|||||||
ccache.clear();
|
ccache.clear();
|
||||||
g_assert_true(ccache.empty());
|
g_assert_true(ccache.empty());
|
||||||
g_assert_cmpuint(ccache.size(),==,0);
|
g_assert_cmpuint(ccache.size(),==,0);
|
||||||
ccache.for_each([&](auto&& contact) { ++n; return true; });
|
assert_valid_result(ccache.for_each([&](auto&& contact) { ++n; return true; }));
|
||||||
g_assert_cmpuint(n,==,0);
|
g_assert_cmpuint(n,==,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -530,12 +530,12 @@ test_mu_contacts_cache_sort()
|
|||||||
if (g_test_verbose())
|
if (g_test_verbose())
|
||||||
fmt::print("contacts-cache:\n");
|
fmt::print("contacts-cache:\n");
|
||||||
|
|
||||||
ccache.for_each([&](auto&& contact) {
|
assert_valid_result(ccache.for_each([&](auto&& contact) {
|
||||||
if (g_test_verbose())
|
if (g_test_verbose())
|
||||||
fmt::print("\t- {}\n", contact.display_name());
|
fmt::print("\t- {}\n", contact.display_name());
|
||||||
str += contact.name;
|
str += contact.name;
|
||||||
return true;
|
return true;
|
||||||
});
|
}));
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -508,7 +508,7 @@ test_xapian()
|
|||||||
assert_equal(xq->get_description(), test.second);
|
assert_equal(xq->get_description(), test.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_directory(testhome);
|
assert_valid_result(remove_directory(testhome));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@ -1043,7 +1043,7 @@ https://trac.xapian.org/ticket/719
|
|||||||
|
|
||||||
MemDb mdb;
|
MemDb mdb;
|
||||||
Config conf{mdb};
|
Config conf{mdb};
|
||||||
conf.set<Config::Id::NgramsEnabled>(true);
|
assert_valid_result(conf.set<Config::Id::NgramsEnabled>(true));
|
||||||
|
|
||||||
TempDir tdir;
|
TempDir tdir;
|
||||||
auto store{make_test_store(tdir.path(), test_msgs, conf)};
|
auto store{make_test_store(tdir.path(), test_msgs, conf)};
|
||||||
@ -1113,11 +1113,13 @@ Boo!
|
|||||||
|
|
||||||
g_assert_true(msg.sexp().to_string().find("shrike") == std::string::npos);
|
g_assert_true(msg.sexp().to_string().find("shrike") == std::string::npos);
|
||||||
|
|
||||||
store.update_labels(msg, Labels::parse_delta_labels("+shrike"," ").value());
|
assert_valid_result(store.update_labels(
|
||||||
|
msg, Labels::parse_delta_labels("+shrike"," ").value()));
|
||||||
|
|
||||||
g_assert_true(msg.sexp().to_string().find("shrike") != std::string::npos);
|
g_assert_true(msg.sexp().to_string().find("shrike") != std::string::npos);
|
||||||
|
|
||||||
store.update_labels(msg, Labels::parse_delta_labels("-shrike"," ").value());
|
assert_valid_result(store.update_labels(
|
||||||
|
msg, Labels::parse_delta_labels("-shrike"," ").value()));
|
||||||
g_assert_true(msg.sexp().to_string().find("shrike") == std::string::npos);
|
g_assert_true(msg.sexp().to_string().find("shrike") == std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,10 +64,10 @@ test_store_reinit()
|
|||||||
{
|
{
|
||||||
MemDb mdb;
|
MemDb mdb;
|
||||||
Config conf{mdb};
|
Config conf{mdb};
|
||||||
conf.set<Config::Id::MaxMessageSize>(1234567);
|
assert_valid_result(conf.set<Config::Id::MaxMessageSize>(1234567));
|
||||||
conf.set<Config::Id::BatchSize>(7654321);
|
assert_valid_result(conf.set<Config::Id::BatchSize>(7654321));
|
||||||
conf.set<Config::Id::PersonalAddresses>(
|
assert_valid_result(conf.set<Config::Id::PersonalAddresses>(
|
||||||
StringVec{ "foo@example.com", "bar@example.com" });
|
StringVec{ "foo@example.com", "bar@example.com" }));
|
||||||
|
|
||||||
auto store{Store::make_new(tempdir.path(), MuTestMaildir, conf)};
|
auto store{Store::make_new(tempdir.path(), MuTestMaildir, conf)};
|
||||||
assert_valid_result(store);
|
assert_valid_result(store);
|
||||||
@ -581,7 +581,7 @@ test_store_circular_symlink()
|
|||||||
// there will be a lot of dups....
|
// there will be a lot of dups....
|
||||||
g_assert_false(store.empty());
|
g_assert_false(store.empty());
|
||||||
|
|
||||||
remove_directory(testhome);
|
assert_valid_result(remove_directory(testhome));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -80,7 +80,7 @@ test_add_ok()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove_directory(testhome);
|
assert_valid_result(remove_directory(testhome));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -108,7 +108,7 @@ test_add_fail()
|
|||||||
g_assert_cmpuint(res->exit_code,!=,0);
|
g_assert_cmpuint(res->exit_code,!=,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_directory(testhome);
|
assert_valid_result(remove_directory(testhome));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ test_remove_ok()
|
|||||||
g_assert_cmpuint(::access(testmsg.c_str(), F_OK), ==, 0);
|
g_assert_cmpuint(::access(testmsg.c_str(), F_OK), ==, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_directory(testhome);
|
assert_valid_result(remove_directory(testhome));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user