diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-15 00:18:23 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-12-15 23:33:32 +0000 |
commit | 0cc1dcc0afd0424e79235ed3053bdbfb83f7adb0 (patch) | |
tree | a942356f7a34e4a1380787a5f56886ba8d72000d /tests/repository | |
parent | 3e0c101aeb102071d50215cbdc928f41415b2307 (diff) | |
download | gobject-introspection-0cc1dcc0afd0424e79235ed3053bdbfb83f7adb0.tar.gz |
baseinfo: don't abort when calling g_base_info_get_name() on a GITypeInfo. Fixes #96
GITypeInfo is a GIBaseInfo so calling g_base_info_get_name() on it should do something
sensible.
g_base_info_get_name() has always been documented to return NULL in case no name
is available so return that instead.
Diffstat (limited to 'tests/repository')
-rw-r--r-- | tests/repository/gitestrepo.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/repository/gitestrepo.c b/tests/repository/gitestrepo.c index 281a5f3b..6c10b076 100644 --- a/tests/repository/gitestrepo.c +++ b/tests/repository/gitestrepo.c @@ -34,6 +34,29 @@ test_constructor_return_type(GIBaseInfo* object_info) g_assert (strcmp (class_name, return_name) == 0); } +static void +test_type_info_get_name (GIRepository *repo) +{ + GIBaseInfo *base; + GIVFuncInfo *vfunc; + GITypeInfo *typeinfo; + + base = g_irepository_find_by_name (repo, "Gio", "File"); + g_assert_nonnull (base); + g_assert_true (GI_IS_INTERFACE_INFO (base)); + vfunc = g_interface_info_find_vfunc ((GIInterfaceInfo*)base, "read_async"); + g_assert_nonnull (vfunc); + g_base_info_unref ((GIBaseInfo*)base); + + typeinfo = g_callable_info_get_return_type (vfunc); + g_assert_nonnull (typeinfo); + g_base_info_unref ((GIBaseInfo*)vfunc); + + /* https://gitlab.gnome.org/GNOME/gobject-introspection/issues/96 */ + g_assert_null (g_base_info_get_name (typeinfo)); + g_base_info_unref ((GIBaseInfo*)typeinfo); +} + int main(int argc, char **argv) @@ -137,6 +160,8 @@ main(int argc, char **argv) g_assert (strcmp (g_base_info_get_name ((GIBaseInfo*)invoker), "get_display") == 0); } + test_type_info_get_name (repo); + /* Error quark tests */ errorinfo = g_irepository_find_by_error_domain (repo, G_RESOLVER_ERROR); g_assert (errorinfo != NULL); |