tests: avoid build warning

Check all the functions that return a Result.
This commit is contained in:
Dirk-Jan C. Binnema
2026-08-17 21:25:54 +03:00
committed by Seth Ladygo
parent d5a48e99f7
commit bdf2c8b6b1
6 changed files with 23 additions and 21 deletions

View File

@ -440,8 +440,8 @@ test_mu_contacts_cache_personal()
{
MemDb xdb{};
Config cdb{xdb};
cdb.set<Config::Id::PersonalAddresses>
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}});
assert_valid_result(cdb.set<Config::Id::PersonalAddresses>
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}}));
ContactsCache contacts{cdb};
g_assert_true(contacts.is_personal("foo@example.com"));
@ -460,8 +460,8 @@ test_mu_contacts_cache_ignored()
{
MemDb xdb{};
Config cdb{xdb};
cdb.set<Config::Id::IgnoredAddresses>
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}});
assert_valid_result(cdb.set<Config::Id::IgnoredAddresses>
(StringVec{{"foo@example.com", "bar@cuux.org", "/bar-.*@fnorb.f./"}}));
ContactsCache contacts{cdb};
g_assert_true(contacts.is_ignored("foo@example.com"));
@ -500,7 +500,7 @@ test_mu_contacts_cache_foreach()
size_t n{};
g_assert_false(ccache.empty());
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);
}
@ -508,7 +508,7 @@ test_mu_contacts_cache_foreach()
size_t n{};
g_assert_false(ccache.empty());
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);
}
@ -517,7 +517,7 @@ test_mu_contacts_cache_foreach()
ccache.clear();
g_assert_true(ccache.empty());
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);
}
}
@ -530,12 +530,12 @@ test_mu_contacts_cache_sort()
if (g_test_verbose())
fmt::print("contacts-cache:\n");
ccache.for_each([&](auto&& contact) {
assert_valid_result(ccache.for_each([&](auto&& contact) {
if (g_test_verbose())
fmt::print("\t- {}\n", contact.display_name());
str += contact.name;
return true;
});
}));
return str;
};

View File

@ -508,7 +508,7 @@ test_xapian()
assert_equal(xq->get_description(), test.second);
}
remove_directory(testhome);
assert_valid_result(remove_directory(testhome));
}
int

View File

@ -1043,7 +1043,7 @@ https://trac.xapian.org/ticket/719
MemDb mdb;
Config conf{mdb};
conf.set<Config::Id::NgramsEnabled>(true);
assert_valid_result(conf.set<Config::Id::NgramsEnabled>(true));
TempDir tdir;
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);
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);
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);
}

View File

@ -64,10 +64,10 @@ test_store_reinit()
{
MemDb mdb;
Config conf{mdb};
conf.set<Config::Id::MaxMessageSize>(1234567);
conf.set<Config::Id::BatchSize>(7654321);
conf.set<Config::Id::PersonalAddresses>(
StringVec{ "foo@example.com", "bar@example.com" });
assert_valid_result(conf.set<Config::Id::MaxMessageSize>(1234567));
assert_valid_result(conf.set<Config::Id::BatchSize>(7654321));
assert_valid_result(conf.set<Config::Id::PersonalAddresses>(
StringVec{ "foo@example.com", "bar@example.com" }));
auto store{Store::make_new(tempdir.path(), MuTestMaildir, conf)};
assert_valid_result(store);
@ -581,7 +581,7 @@ test_store_circular_symlink()
// there will be a lot of dups....
g_assert_false(store.empty());
remove_directory(testhome);
assert_valid_result(remove_directory(testhome));
}
static void