mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-31 06:13:29 +02:00
gtestutils: Add g_test_summary() to add summary metadata to unit tests
This is a new function along the same lines as g_test_bug(): to allow developers to annotate unit tests with information about the test (what it tests, how it tests it) for future developers to read and learn from. It will also output this summary as a comment in the test’s TAP output, which might clarify test results. Includes a unit test. Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #1450
This commit is contained in:
@@ -47,6 +47,14 @@ test_incomplete (void)
|
||||
g_test_incomplete ("mind reading not implemented yet");
|
||||
}
|
||||
|
||||
static void
|
||||
test_summary (void)
|
||||
{
|
||||
g_test_summary ("Tests that g_test_summary() works with TAP, by outputting a "
|
||||
"known summary message in testing-helper, and checking for "
|
||||
"it in the TAP output later.");
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@@ -114,6 +122,10 @@ main (int argc,
|
||||
g_test_add_func ("/c/a", test_pass);
|
||||
g_test_add_func ("/d/a", test_pass);
|
||||
}
|
||||
else if (g_strcmp0 (argv1, "summary") == 0)
|
||||
{
|
||||
g_test_add_func ("/summary", test_summary);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
|
Reference in New Issue
Block a user