From 6e1d205ad30e9a3c031d0660f909dbed8665dee4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 18 Aug 2012 14:40:15 -0400 Subject: [PATCH] Improve GError test coverage --- glib/tests/error.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/glib/tests/error.c b/glib/tests/error.c index 66ec6e0fe..be03cfd7c 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 (); }