[network-manager-vpnc/th/vpn-editor-split-bgo766170: 9/19] properties/tests: use nmtst_init() to setup test



commit d9f601727e82c1abdcaa10e3b942ffc9300f4682
Author: Thomas Haller <thaller redhat com>
Date:   Mon May 9 11:20:15 2016 +0200

    properties/tests: use nmtst_init() to setup test
    
    The test will be converted to run via g_run_tests(), thus we must also
    call g_test_init(), in addition to g_type_init().
    
    nmtst_init() does that all for us, and additionally it provides useful
    functionality for tests, among others:
    
      - initializes a GRand instance (optionally with seed from environment
        NMTST_SEED_RAND
      - allows to disable g_test_expect_message() by setting NMTST_DEBUG
      - set G_MESSAGES_DEBUG to enable g_debug() messages when running
        with NMTST_DEBUG=debug

 properties/tests/test-import-export.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 3469df6..852ccc4 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -610,16 +610,15 @@ test_empty_keyfile_string_null (const char *dir)
        g_key_file_free (kf);
 }
 
+NMTST_DEFINE ();
+
 int main (int argc, char **argv)
 {
        GError *error = NULL;
        int errsv;
-       char *basename;
        NMVpnEditorPlugin *plugin = NULL;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
+       nmtst_init (&argc, &argv, TRUE);
 
        if (mkdir (TMPDIR, 0755) != 0) {
                errsv = errno;
@@ -650,10 +649,6 @@ int main (int argc, char **argv)
        test_empty_keyfile_string_null (SRCDIR);
 
        g_object_unref (plugin);
-
-       basename = g_path_get_basename (argv[0]);
-       fprintf (stdout, "%s: SUCCESS\n", basename);
-       g_free (basename);
        return 0;
 }
 


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