glib-autocleanups: Define the cleanup function for GDate

Add an autoptr test as well.
This commit is contained in:
Marco Trevisan (Treviño) 2019-11-27 17:07:06 +01:00
parent f3de395812
commit c08d58d778
2 changed files with 9 additions and 0 deletions

View File

@ -47,6 +47,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)

View File

@ -69,6 +69,13 @@ test_g_checksum (void)
g_assert_nonnull (val);
}
static void
test_g_date (void)
{
g_autoptr(GDate) val = g_date_new ();
g_assert_nonnull (val);
}
static void
test_g_date_time (void)
{
@ -704,6 +711,7 @@ main (int argc, gchar *argv[])
g_test_add_func ("/autoptr/g_bookmark_file", test_g_bookmark_file);
g_test_add_func ("/autoptr/g_bytes", test_g_bytes);
g_test_add_func ("/autoptr/g_checksum", test_g_checksum);
g_test_add_func ("/autoptr/g_date", test_g_date);
g_test_add_func ("/autoptr/g_date_time", test_g_date_time);
g_test_add_func ("/autoptr/g_dir", test_g_dir);
g_test_add_func ("/autoptr/g_error", test_g_error);