mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
Fix g_test_add_vtable
This function was creating a test suite for each added testcase, when it should have grouped tests according to their paths.
This commit is contained in:
parent
1cd0cf3797
commit
89aa9dbd98
@ -1377,6 +1377,15 @@ g_test_create_case (const char *test_name,
|
||||
return tc;
|
||||
}
|
||||
|
||||
static gint
|
||||
find_suite (gconstpointer l, gconstpointer s)
|
||||
{
|
||||
const GTestSuite *suite = l;
|
||||
const gchar *str = s;
|
||||
|
||||
return strcmp (suite->name, str);
|
||||
}
|
||||
|
||||
/**
|
||||
* GTestFixtureFunc:
|
||||
* @fixture: the test fixture
|
||||
@ -1426,8 +1435,18 @@ g_test_add_vtable (const char *testpath,
|
||||
continue; /* initial or duplicate slash */
|
||||
else if (!islast)
|
||||
{
|
||||
GTestSuite *csuite = g_test_create_suite (seg);
|
||||
g_test_suite_add_suite (suite, csuite);
|
||||
GSList *l;
|
||||
GTestSuite *csuite;
|
||||
l = g_slist_find_custom (suite->suites, seg, find_suite);
|
||||
if (l)
|
||||
{
|
||||
csuite = l->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
csuite = g_test_create_suite (seg);
|
||||
g_test_suite_add_suite (suite, csuite);
|
||||
}
|
||||
suite = csuite;
|
||||
}
|
||||
else /* islast */
|
||||
|
Loading…
Reference in New Issue
Block a user