Merge branch 'test-bug-base' into 'master'

Relax use of g_test_bug() to not require g_test_bug_base() to be called first

See merge request GNOME/glib!1044
This commit is contained in:
Philip Withnall 2019-08-21 17:21:52 +00:00
commit 5f5f98f3d0
3 changed files with 11 additions and 8 deletions

View File

@ -2321,7 +2321,6 @@ main (int argc, char **argv)
int ret;
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("");
loop = g_main_loop_new (NULL, FALSE);
main_thread = g_thread_self ();

View File

@ -150,7 +150,6 @@
* setlocale (LC_ALL, "");
*
* g_test_init (&argc, &argv, NULL);
* g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=");
*
* // Define the tests.
* g_test_add ("/my-object/test1", MyObjectFixture, "some-user-data",
@ -1887,6 +1886,9 @@ g_test_message (const char *format,
* portion to @uri_pattern, or by replacing the special string
* '\%s' within @uri_pattern if that is present.
*
* If g_test_bug_base() is not called, bug URIs are formed solely
* from the value provided by g_test_bug().
*
* Since: 2.16
*/
void
@ -1903,7 +1905,9 @@ g_test_bug_base (const char *uri_pattern)
* This function adds a message to test reports that
* associates a bug URI with a test case.
* Bug URIs are constructed from a base URI set with g_test_bug_base()
* and @bug_uri_snippet.
* and @bug_uri_snippet. If g_test_bug_base() has not been called, it is
* assumed to be the empty string, so a full URI can be provided to
* g_test_bug() instead.
*
* Since: 2.16
* See also: g_test_summary()
@ -1911,11 +1915,11 @@ g_test_bug_base (const char *uri_pattern)
void
g_test_bug (const char *bug_uri_snippet)
{
char *c;
const char *c = NULL;
g_return_if_fail (test_uri_base != NULL);
g_return_if_fail (bug_uri_snippet != NULL);
if (test_uri_base != NULL)
c = strstr (test_uri_base, "%s");
if (c)
{
@ -1926,7 +1930,8 @@ g_test_bug (const char *bug_uri_snippet)
g_free (s);
}
else
g_test_message ("Bug Reference: %s%s", test_uri_base, bug_uri_snippet);
g_test_message ("Bug Reference: %s%s",
test_uri_base ? test_uri_base : "", bug_uri_snippet);
}
/**

View File

@ -188,7 +188,6 @@ int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("");
g_test_add_func ("/timeout/seconds", test_seconds);
g_test_add_func ("/timeout/weeks-overflow", test_weeks_overflow);