girepository: Return enumerated versions as a GStrv

Returning list of strings is a bad idea, so let's do not now since
we're exposing the API for the first time.
This commit is contained in:
Marco Trevisan (Treviño)
2023-12-20 05:11:38 +01:00
parent 30d6e911c4
commit cd8f511262
3 changed files with 38 additions and 9 deletions

View File

@@ -32,6 +32,8 @@ test_repository_basic (void)
char **namespaces = NULL;
const char *expected_namespaces[] = { "GLib", NULL };
GError *local_error = NULL;
char **versions;
size_t n_versions;
g_test_summary ("Test basic opening of a repository and requiring a typelib");
@@ -42,6 +44,17 @@ test_repository_basic (void)
repository = gi_repository_new ();
g_assert_nonnull (repository);
versions = gi_repository_enumerate_versions (repository, "SomeInvalidNamespace", &n_versions);
g_assert_nonnull (versions);
g_assert_cmpstrv (versions, ((char *[]){NULL}));
g_assert_cmpuint (n_versions, ==, 0);
g_clear_pointer (&versions, g_strfreev);
versions = gi_repository_enumerate_versions (repository, "GLib", NULL);
g_assert_nonnull (versions);
g_assert_cmpstrv (versions, ((char *[]){"2.0", NULL}));
g_clear_pointer (&versions, g_strfreev);
search_path = gi_repository_get_search_path ();
g_assert_nonnull (search_path);
g_assert_cmpstr (search_path->data, ==, gobject_typelib_dir);