Merge branch 'more-type-query-tests' into 'main'

tests: Add some more tests for g_type_query()

See merge request GNOME/glib!3517
This commit is contained in:
Philip Withnall 2023-07-30 12:52:28 +00:00
commit d803c63c81

View File

@ -215,6 +215,20 @@ test_is_a (void)
g_assert_false ((g_type_is_a) (bar_get_type (), bibi_get_type ()));
}
static void
test_query (void)
{
GTypeQuery results;
g_test_message ("Invalid types cant be queried.");
g_type_query (G_TYPE_INVALID, &results);
g_assert_cmpuint (results.type, ==, 0);
g_test_message ("Unclassed types cant be queried.");
g_type_query (G_TYPE_INT64, &results);
g_assert_cmpuint (results.type, ==, 0);
}
int
main (int argc, char *argv[])
{
@ -225,6 +239,7 @@ main (int argc, char *argv[])
g_test_add_func ("/type/interface-check", test_interface_check);
g_test_add_func ("/type/next-base", test_next_base);
g_test_add_func ("/type/is-a", test_is_a);
g_test_add_func ("/type/query", test_query);
return g_test_run ();
}