[PATCH v3] [glib 4/5] gconfig, tests: Separate XML loading function

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

 



We'll need to load XML from file in another function, that will be added
in a following patch.
---
 tests/test-gconfig.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
index a26bb5f..5389a26 100644
--- a/tests/test-gconfig.c
+++ b/tests/test-gconfig.c
@@ -30,12 +30,11 @@
     g_free(alloced_str); \
 } G_STMT_END
 
-static void check_xml(GVirConfigDomain *domain, const char *reference_file)
+static char * load_xml(const char *reference_file)
 {
     const char *reference_path;
     GError *error = NULL;
     char *reference_xml;
-    char *xml;
 
     reference_path = g_test_get_filename(G_TEST_DIST, "xml",
                                          reference_file, NULL);
@@ -45,6 +44,18 @@ static void check_xml(GVirConfigDomain *domain, const char *reference_file)
      * gedit, workaround this issue by removing trailing whitespace from
      * the reference file */
     g_strchomp(reference_xml);
+
+    return reference_xml;
+}
+
+
+static void check_xml(GVirConfigDomain *domain, const char *reference_file)
+{
+    char *reference_xml;
+    char *xml;
+
+    reference_xml = load_xml(reference_file);
+
     xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(domain));
     g_assert_cmpstr(xml, ==, reference_xml);
     g_free(xml);
-- 
2.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]