From fed8ae38c3b43c8da693c624bb552c50d269af84 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 1 Jun 2013 00:36:16 -0400 Subject: [PATCH] Improve test coverage a bit --- gio/tests/file.c | 20 ++++++++++++++++++++ gio/tests/memory-output-stream.c | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/gio/tests/file.c b/gio/tests/file.c index c59a660..8edb290 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -103,6 +103,25 @@ test_type (void) g_object_unref (datapath_f); } +static void +test_parse_name (void) +{ + GFile *file; + gchar *name; + + file = g_file_new_for_uri ("file://somewhere"); + name = g_file_get_parse_name (file); + g_assert_cmpstr (name, ==, "file://somewhere"); + g_object_unref (file); + g_free (name); + + file = g_file_parse_name ("~foo"); + name = g_file_get_parse_name (file); + g_assert (name != NULL); + g_print (name); + g_object_unref (file); + g_free (name); +} typedef struct { @@ -799,6 +818,7 @@ main (int argc, char *argv[]) g_test_add_func ("/file/parent", test_parent); g_test_add_func ("/file/child", test_child); g_test_add_func ("/file/type", test_type); + g_test_add_func ("/file/parse-name", test_parse_name); g_test_add_data_func ("/file/async-create-delete/0", GINT_TO_POINTER (0), test_create_delete); g_test_add_data_func ("/file/async-create-delete/1", GINT_TO_POINTER (1), test_create_delete); g_test_add_data_func ("/file/async-create-delete/10", GINT_TO_POINTER (10), test_create_delete); diff --git a/gio/tests/memory-output-stream.c b/gio/tests/memory-output-stream.c index 3399bbe..1fc1074 100644 --- a/gio/tests/memory-output-stream.c +++ b/gio/tests/memory-output-stream.c @@ -122,6 +122,7 @@ test_properties (void) gsize data_size_prop; gpointer data_fun; gpointer data_prop; + gpointer func; g_test_bug ("605733"); @@ -145,6 +146,15 @@ test_properties (void) g_object_get (mo, "data", &data_prop, NULL); g_assert_cmphex (GPOINTER_TO_SIZE (data_fun), ==, GPOINTER_TO_SIZE (data_prop)); + g_object_get (mo, "realloc-function", &func, NULL); + g_assert (func == g_realloc); + g_object_get (mo, "destroy-function", &func, NULL); + g_assert (func == g_free); + + data_size_fun = g_memory_output_stream_get_size (G_MEMORY_OUTPUT_STREAM (mo)); + g_object_get (mo, "size", &data_size_prop, NULL); + g_assert_cmpint (data_size_fun, ==, data_size_prop); + g_object_unref (o); g_object_unref (mo); } -- 2.7.4