[glib] Improve GError test coverage



commit 6e1d205ad30e9a3c031d0660f909dbed8665dee4
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 18 14:40:15 2012 -0400

    Improve GError test coverage

 glib/tests/error.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/error.c b/glib/tests/error.c
index 66ec6e0..be03cfd 100644
--- a/glib/tests/error.c
+++ b/glib/tests/error.c
@@ -61,6 +61,23 @@ test_literal (void)
   g_error_free (error);
 }
 
+static void
+test_copy (void)
+{
+  GError *error;
+  GError *copy;
+
+  error = NULL;
+  g_set_error_literal (&error, G_MARKUP_ERROR, G_MARKUP_ERROR_EMPTY, "%s %d %x");
+  copy = g_error_copy (error);
+
+  g_assert_error (copy, G_MARKUP_ERROR, G_MARKUP_ERROR_EMPTY);
+  g_assert_cmpstr (copy->message, ==, "%s %d %x");
+
+  g_error_free (error);
+  g_error_free (copy);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -69,6 +86,7 @@ main (int argc, char *argv[])
   g_test_add_func ("/error/overwrite", test_overwrite);
   g_test_add_func ("/error/prefix", test_prefix);
   g_test_add_func ("/error/literal", test_literal);
+  g_test_add_func ("/error/copy", test_copy);
 
   return g_test_run ();
 }



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