mirror of https://github.com/djcb/mu.git
tests: improve coverage a bit
This commit is contained in:
parent
046398b1ae
commit
91dcd19dad
|
@ -65,10 +65,10 @@ covfile:=$(COVERAGE_BUILDDIR)/meson-logs/coverage.info
|
||||||
coverage: $(COVERAGE_BUILDDIR)
|
coverage: $(COVERAGE_BUILDDIR)
|
||||||
ninja -C $(COVERAGE_BUILDDIR) test
|
ninja -C $(COVERAGE_BUILDDIR) test
|
||||||
lcov --capture --directory . --output-file $(covfile)
|
lcov --capture --directory . --output-file $(covfile)
|
||||||
lcov --remove $(covfile) '/usr/*' '*guile*' '*thirdparty*' '*/tests/*' --output $(covfile)
|
@lcov --remove $(covfile) '/usr/*' '*guile*' '*thirdparty*' '*/tests/*' '*mime-object*' --output $(covfile)
|
||||||
mkdir -p $(COVERAGE_BUILDDIR)/meson-logs/coverage
|
@mkdir -p $(COVERAGE_BUILDDIR)/meson-logs/coverage
|
||||||
genhtml $(covfile) --output-directory $(COVERAGE_BUILDDIR)/meson-logs/coverage/
|
@genhtml $(covfile) --output-directory $(COVERAGE_BUILDDIR)/meson-logs/coverage/
|
||||||
|
@echo "coverage report at: file://$(COVERAGE_BUILDDIR)/meson/logs/coverage/index.html"
|
||||||
dist: $(BUILDDIR)
|
dist: $(BUILDDIR)
|
||||||
@cd $(BUILDDIR); $(MESON) dist
|
@cd $(BUILDDIR); $(MESON) dist
|
||||||
|
|
||||||
|
|
|
@ -439,6 +439,10 @@ C0bdoCx44QVU8HaZ2x91h3GoM/0q5bqM/rvCauwbokiJgAUrznecNPY=
|
||||||
if (!part.is_encrypted())
|
if (!part.is_encrypted())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
g_assert_false(!!part.content_description());
|
||||||
|
g_assert_false(part.is_attachment());
|
||||||
|
g_assert_cmpuint(part.size(),==,0);
|
||||||
|
|
||||||
const auto& mobj{part.mime_object()};
|
const auto& mobj{part.mime_object()};
|
||||||
if (!mobj.is_multipart_encrypted())
|
if (!mobj.is_multipart_encrypted())
|
||||||
continue;
|
continue;
|
||||||
|
@ -469,6 +473,8 @@ Content-Type: message/rfc822
|
||||||
)";
|
)";
|
||||||
auto message{Message::make_from_text(msgtext)};
|
auto message{Message::make_from_text(msgtext)};
|
||||||
g_assert_true(!!message);
|
g_assert_true(!!message);
|
||||||
|
|
||||||
|
g_assert_true(message->cached_sexp().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,54 @@ test_mu_util_program_in_path(void)
|
||||||
g_assert_cmpuint(mu_util_program_in_path("ls"), ==, TRUE);
|
g_assert_cmpuint(mu_util_program_in_path("ls"), ==, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_mu_util_summarize(void)
|
||||||
|
{
|
||||||
|
const char *txt =
|
||||||
|
"Khiron was fortified and made the seat of a pargana during "
|
||||||
|
"the reign of Asaf-ud-Daula.\n\the headquarters had previously "
|
||||||
|
"been at Satanpur since its foundation and fortification by "
|
||||||
|
"the Bais raja Sathna.\n\nKhiron was also historically the seat "
|
||||||
|
"of a taluqdari estate belonging to a Janwar dynasty.\n"
|
||||||
|
"There were also several Kayasth qanungo families, "
|
||||||
|
"including many descended from Rai Sahib Rai, who had been "
|
||||||
|
"a chakladar under the Nawabs of Awadh.";
|
||||||
|
|
||||||
|
char *summ = mu_str_summarize(txt, 3);
|
||||||
|
g_assert_cmpstr(summ, ==,
|
||||||
|
"Khiron was fortified and made the seat of a pargana "
|
||||||
|
"during the reign of Asaf-ud-Daula. he headquarters had "
|
||||||
|
"previously been at Satanpur since its foundation and "
|
||||||
|
"fortification by the Bais raja Sathna. ");
|
||||||
|
g_free (summ);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_mu_error(void)
|
||||||
|
{
|
||||||
|
GQuark q;
|
||||||
|
GError *err;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
q = mu_util_error_quark();
|
||||||
|
g_assert_true(q != 0);
|
||||||
|
|
||||||
|
|
||||||
|
err = NULL;
|
||||||
|
res = mu_util_g_set_error(&err, MU_ERROR_IN_PARAMETERS,
|
||||||
|
"Hello, %s!", "World");
|
||||||
|
|
||||||
|
g_assert_false(res);
|
||||||
|
g_assert_cmpuint(err->domain, ==, q);
|
||||||
|
g_assert_cmpuint(err->code, ==, MU_ERROR_IN_PARAMETERS);
|
||||||
|
g_assert_cmpstr(err->message,==,"Hello, World!");
|
||||||
|
|
||||||
|
g_clear_error(&err);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
@ -231,5 +279,8 @@ main(int argc, char* argv[])
|
||||||
g_test_add_func("/mu-util/mu-util-program-in-path",
|
g_test_add_func("/mu-util/mu-util-program-in-path",
|
||||||
test_mu_util_program_in_path);
|
test_mu_util_program_in_path);
|
||||||
|
|
||||||
|
g_test_add_func("/mu-util/summarize", test_mu_util_summarize);
|
||||||
|
g_test_add_func("/mu-util/error", test_mu_error);
|
||||||
|
|
||||||
return g_test_run();
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue