mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-29 08:56:15 +01:00
gtestutils: Allow g_test_bug() to be used without g_test_bug_base()
Since we transitioned from Bugzilla to GitLab, we have two forms of bug references in the GLib source code: old (but still relevant) Bugzilla links, and newer GitLab links. We can’t use a single base for the two, so have to either build incorrect URIs, or provide the full URI in g_test_bug(). It’s always seemed a bit of an over-optimisation to provide the bug base separately from the bug ID, so relax the assertions and documentation around g_test_bug_base() so that g_test_bug() can be used on its own. The old usage patterns are still supported unchanged. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
10be2c12ab
commit
e7b857a44a
@ -150,7 +150,6 @@
|
|||||||
* setlocale (LC_ALL, "");
|
* setlocale (LC_ALL, "");
|
||||||
*
|
*
|
||||||
* g_test_init (&argc, &argv, NULL);
|
* g_test_init (&argc, &argv, NULL);
|
||||||
* g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=");
|
|
||||||
*
|
*
|
||||||
* // Define the tests.
|
* // Define the tests.
|
||||||
* g_test_add ("/my-object/test1", MyObjectFixture, "some-user-data",
|
* 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
|
* portion to @uri_pattern, or by replacing the special string
|
||||||
* '\%s' within @uri_pattern if that is present.
|
* '\%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
|
* Since: 2.16
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@ -1903,7 +1905,9 @@ g_test_bug_base (const char *uri_pattern)
|
|||||||
* This function adds a message to test reports that
|
* This function adds a message to test reports that
|
||||||
* associates a bug URI with a test case.
|
* associates a bug URI with a test case.
|
||||||
* Bug URIs are constructed from a base URI set with g_test_bug_base()
|
* 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
|
* Since: 2.16
|
||||||
* See also: g_test_summary()
|
* See also: g_test_summary()
|
||||||
@ -1911,11 +1915,11 @@ g_test_bug_base (const char *uri_pattern)
|
|||||||
void
|
void
|
||||||
g_test_bug (const char *bug_uri_snippet)
|
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);
|
g_return_if_fail (bug_uri_snippet != NULL);
|
||||||
|
|
||||||
|
if (test_uri_base != NULL)
|
||||||
c = strstr (test_uri_base, "%s");
|
c = strstr (test_uri_base, "%s");
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
@ -1926,7 +1930,8 @@ g_test_bug (const char *bug_uri_snippet)
|
|||||||
g_free (s);
|
g_free (s);
|
||||||
}
|
}
|
||||||
else
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user