From: Matthias Clasen Date: Sun, 20 Jan 2013 08:14:24 +0000 (-0500) Subject: Fix g_test_add_vtable X-Git-Tag: 2.35.6~59 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89aa9dbd9871d6f6cffc25ae8cb02e3b764a25b6;p=platform%2Fupstream%2Fglib.git 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. --- diff --git a/glib/gtestutils.c b/glib/gtestutils.c index c7b7249..ace550d 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -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 */