diff --git a/glib/gtestutils.c b/glib/gtestutils.c index 881789087..80f7b4961 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -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,12 +1915,12 @@ 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); - c = strstr (test_uri_base, "%s"); + if (test_uri_base != NULL) + c = strstr (test_uri_base, "%s"); if (c) { char *b = g_strndup (test_uri_base, c - test_uri_base); @@ -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); } /**