diff --git a/glib/glib-autocleanups.h b/glib/glib-autocleanups.h index b71101f2d..acd38a7ab 100644 --- a/glib/glib-autocleanups.h +++ b/glib/glib-autocleanups.h @@ -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) diff --git a/glib/tests/autoptr.c b/glib/tests/autoptr.c index 14b95a9cc..788d05c5e 100644 --- a/glib/tests/autoptr.c +++ b/glib/tests/autoptr.c @@ -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); diff --git a/tests/testgdate.c b/tests/testgdate.c index 18022bc74..9e2ace22f 100644 --- a/tests/testgdate.c +++ b/tests/testgdate.c @@ -8,6 +8,7 @@ #include "glib.h" #include +#include #include #include #include @@ -506,7 +507,7 @@ g_print ("testing %d years\n", n_check_years); g_print("\n%u tests passed, %u failed\n",passed, notpassed); - return 0; + return (notpassed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }