diff --git a/lib/tests/test-query.cc b/lib/tests/test-query.cc index d84fbea3..2ebcdd1e 100644 --- a/lib/tests/test-query.cc +++ b/lib/tests/test-query.cc @@ -54,12 +54,14 @@ test_query() auto dump_matches = [](const QueryResults& res) { size_t n{}; - for (auto&& item : res) + for (auto&& item : res) { + std::cout << item.query_match() << '\n'; if (g_test_verbose()) g_debug("%02zu %s %s", ++n, item.path().value_or("").c_str(), item.message_id().value_or("").c_str()); + } }; g_assert_cmpuint(store->size(), ==, 19); @@ -69,6 +71,9 @@ test_query() g_assert_true(!!res); g_assert_cmpuint(res->size(), ==, 19); dump_matches(*res); + + g_assert_cmpuint(store->count_query(""), ==, 19); + } { diff --git a/lib/utils/mu-sexp.cc b/lib/utils/mu-sexp.cc index ef8182e4..a8e1ff65 100644 --- a/lib/utils/mu-sexp.cc +++ b/lib/utils/mu-sexp.cc @@ -208,6 +208,8 @@ Sexp::to_sexp_string() const return sstrm.str(); } +// LCOV_EXCL_START + std::string Sexp::to_json_string() const { @@ -264,3 +266,5 @@ Sexp::to_json_string() const return sstrm.str(); } + +// LCOV_EXCL_STOP diff --git a/lib/utils/mu-util.c b/lib/utils/mu-util.c index ab38e719..51928881 100644 --- a/lib/utils/mu-util.c +++ b/lib/utils/mu-util.c @@ -435,42 +435,6 @@ mu_util_print_encoded (const char *frm, ...) return rv; } -gboolean -mu_util_printerr_encoded (const char *frm, ...) -{ - va_list args; - gboolean rv; - - g_return_val_if_fail (frm, FALSE); - - va_start (args, frm); - rv = print_args (stderr, frm, args); - va_end (args); - - return rv; -} - - -char* -mu_util_read_password (const char *prompt) -{ - char *pass; - - g_return_val_if_fail (prompt, NULL); - - /* note: getpass is obsolete; replace with something better */ - - pass = getpass (prompt); /* returns static mem, don't free */ - if (!pass) { - if (errno) - g_warning ("error: %s", g_strerror(errno)); - return NULL; - } - - return g_strdup(pass); -} - - char* mu_str_summarize (const char* str, size_t max_lines) { diff --git a/lib/utils/mu-util.h b/lib/utils/mu-util.h index 86423efe..95978113 100644 --- a/lib/utils/mu-util.h +++ b/lib/utils/mu-util.h @@ -139,26 +139,6 @@ gboolean mu_util_fputs_encoded (const char *str, FILE *stream); */ gboolean mu_util_print_encoded (const char *frm, ...) G_GNUC_PRINTF(1,2); -/** - * print a formatted string (assumed to be in utf8-format) to stderr, - * converted to the current locale - * - * @param a standard printf() format string, followed by a parameter list - * - * @return TRUE if printing worked, FALSE otherwise - */ -gboolean mu_util_printerr_encoded (const char *frm, ...) G_GNUC_PRINTF(1,2); - - -/** - * read a password from stdin (without echoing), and return it. - * - * @param prompt the prompt text before the password - * - * @return the password (free with g_free), or NULL - */ -char* mu_util_read_password (const char *prompt) - G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; /** * Try to 'play' (ie., open with it's associated program) a file. On diff --git a/lib/utils/mu-xapian-utils.hh b/lib/utils/mu-xapian-utils.hh index 110a34b3..12f3c2ce 100644 --- a/lib/utils/mu-xapian-utils.hh +++ b/lib/utils/mu-xapian-utils.hh @@ -26,6 +26,8 @@ namespace Mu { +// LCOV_EXCL_START + // avoid exception-handling boilerplate. template void @@ -77,8 +79,7 @@ try { return Err(Error::Code::Internal, "caught exception"); } - - +// LCOV_EXCL_STOP } // namespace Mu diff --git a/lib/utils/tests/test-sexp.cc b/lib/utils/tests/test-sexp.cc index d0bfc0f9..770a1570 100644 --- a/lib/utils/tests/test-sexp.cc +++ b/lib/utils/tests/test-sexp.cc @@ -96,6 +96,7 @@ test_prop_list() l1.add_prop(":foo", Sexp::make_string("bar")); Sexp s2{Sexp::make_list(std::move(l1))}; assert_equal(s2.to_sexp_string(), "(:foo \"bar\")"); + g_assert_true(s2.is_prop_list()); Sexp::List l2; const std::string x{"bar"}; @@ -151,6 +152,16 @@ test_prop_list_remove() assert_equal(Sexp::make_list(Sexp::List{lst}).to_sexp_string(), R"((:foo "123"))"); + + lst.clear(); + g_assert_cmpuint(lst.size(), ==, 0); + } + + { + Sexp::List lst; + lst.add(Sexp::make_number(123)); + Sexp s2{Sexp::make_list(std::move(lst))}; + g_assert_false(s2.is_prop_list()); } }