[gobject-introspection/tintou/repository-test-fix: 5/5] gitypelibtest: make tests fail if the library can't be found



commit e4842358706e41b2dbe30fb6e27d2c57effd4876
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sat Oct 19 19:14:05 2019 +0200

    gitypelibtest: make tests fail if the library can't be found
    
    Check that g_object_info_get_ref_function_pointer() actually returns something,
    which it doesn't if the shared lib isn't found.
    
    In case a shared lib isn't found g-i will emit a warning, so also make sure
    we fail on warnings to avoid similar problems in the future.

 tests/repository/gitypelibtest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/tests/repository/gitypelibtest.c b/tests/repository/gitypelibtest.c
index 6620f1ea..c0398d97 100644
--- a/tests/repository/gitypelibtest.c
+++ b/tests/repository/gitypelibtest.c
@@ -163,7 +163,7 @@ test_fundamental_get_ref_function_pointer (GIRepository * repo)
 
   g_assert (g_irepository_require (repo, "Regress", NULL, 0, NULL));
   info = g_irepository_find_by_name (repo, "Regress", "TestFundamentalObject");
-  g_object_info_get_ref_function_pointer (info);
+  g_assert_nonnull (g_object_info_get_ref_function_pointer (info));
   g_base_info_unref (info);
 }
 
@@ -308,6 +308,8 @@ main (int argc, char **argv)
 {
   GIRepository *repo;
 
+  g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL);
+
   repo = g_irepository_get_default ();
 
   /* do tests */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]