Improve test coverage a bit

This commit is contained in:
Matthias Clasen 2013-06-01 00:36:16 -04:00
parent c0f96bb276
commit fed8ae38c3
2 changed files with 30 additions and 0 deletions

View File

@ -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);

View File

@ -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);
}