diff --git a/egg/egg-testing.c b/egg/egg-testing.c index 561e16a..b702b04 100644 --- a/egg/egg-testing.c +++ b/egg/egg-testing.c @@ -47,7 +47,7 @@ egg_test_escape_data (const guchar *data, gsize i; guchar j; - g_assert (data != NULL); + g_assert_nonnull (data); result = g_string_sized_new (n_data * 2 + 1); for (i = 0; i < n_data; ++i) { @@ -94,14 +94,14 @@ static gboolean (*wait_until_impl) (int timeout); void egg_test_wait_stop (void) { - g_assert (wait_stop_impl != NULL); + g_assert_nonnull (wait_stop_impl); (wait_stop_impl) (); } gboolean egg_test_wait_until (int timeout) { - g_assert (wait_until_impl != NULL); + g_assert_nonnull (wait_until_impl); return (wait_until_impl) (timeout); } @@ -110,7 +110,7 @@ egg_test_wait_idle (void) { GMainContext *context; - g_assert (wait_until_impl != NULL); + g_assert_nonnull (wait_until_impl); context = g_main_context_get_thread_default (); while (g_main_context_iteration (context, FALSE)); @@ -121,7 +121,7 @@ static GMainLoop *wait_loop = NULL; static void loop_wait_stop (void) { - g_assert (wait_loop != NULL); + g_assert_nonnull (wait_loop); g_main_loop_quit (wait_loop); } @@ -131,7 +131,7 @@ on_loop_wait_timeout (gpointer data) gboolean *timed_out = data; *timed_out = TRUE; - g_assert (wait_loop != NULL); + g_assert_nonnull (wait_loop); g_main_loop_quit (wait_loop); return TRUE; /* we remove this source later */ @@ -143,7 +143,7 @@ loop_wait_until (int timeout) gboolean timed_out = FALSE; guint source; - g_assert (wait_loop == NULL); + g_assert_null (wait_loop); wait_loop = g_main_loop_new (g_main_context_get_thread_default (), FALSE); source = g_timeout_add (timeout, on_loop_wait_timeout, &timed_out); diff --git a/egg/egg-testing.h b/egg/egg-testing.h index 8786cf8..1f07f0c 100644 --- a/egg/egg-testing.h +++ b/egg/egg-testing.h @@ -48,7 +48,7 @@ gchar * egg_test_escape_data (const guchar *data, void egg_test_wait_stop (void); -#define egg_test_wait() g_assert (egg_test_wait_until (20000) != FALSE) +#define egg_test_wait() g_assert_true (egg_test_wait_until (20000)) gboolean egg_test_wait_until (int timeout); diff --git a/egg/test-dh.c b/egg/test-dh.c index c95f479..46fbc27 100644 --- a/egg/test-dh.c +++ b/egg/test-dh.c @@ -51,19 +51,19 @@ test_perform (void) /* Generate secrets */ ret = egg_dh_gen_pair (p, g, 0, &X1, &x1); - g_assert (ret); + g_assert_true (ret); ret = egg_dh_gen_pair (p, g, 0, &X2, &x2); - g_assert (ret); + g_assert_true (ret); /* Calculate keys */ k1 = egg_dh_gen_secret (X2, x1, p, &n1); - g_assert (k1); + g_assert_nonnull (k1); k2 = egg_dh_gen_secret (X1, x2, p, &n2); - g_assert (k2); + g_assert_nonnull (k2); /* Keys must be the same */ egg_assert_cmpsize (n1, ==, n2); - g_assert (memcmp (k1, k2, n1) == 0); + g_assert_true (memcmp (k1, k2, n1) == 0); gcry_mpi_release (p); gcry_mpi_release (g); @@ -84,12 +84,12 @@ test_short_pair (void) /* Load up the parameters */ ret = egg_dh_default_params ("ietf-ike-grp-modp-1024", &p, &g); - g_assert (ret); + g_assert_true (ret); g_assert_cmpuint (gcry_mpi_get_nbits (p), ==, 1024); /* Generate secrets */ ret = egg_dh_gen_pair (p, g, 512, &X1, &x1); - g_assert (ret); + g_assert_true (ret); g_assert_cmpuint (gcry_mpi_get_nbits (x1), <=, 512); gcry_mpi_release (p); @@ -108,25 +108,25 @@ check_dh_default (const gchar *name, guint bits) gcry_error_t gcry; ret = egg_dh_default_params (name, &p, &g); - g_assert (ret); + g_assert_true (ret); g_assert_cmpint (gcry_mpi_get_nbits (p), ==, bits); g_assert_cmpint (gcry_mpi_get_nbits (g), <, gcry_mpi_get_nbits (p)); ret = egg_dh_default_params_raw (name, &prime, &n_prime, &base, &n_base); - g_assert (ret); - g_assert (prime != NULL); + g_assert_true (ret); + g_assert_nonnull (prime); egg_assert_cmpsize (n_prime, >, 0); - g_assert (base != NULL); + g_assert_nonnull (base); egg_assert_cmpsize (n_base, >, 0); gcry = gcry_mpi_scan (&check, GCRYMPI_FMT_USG, prime, n_prime, NULL); - g_assert (gcry == 0); - g_assert (gcry_mpi_cmp (check, p) == 0); + g_assert_true (gcry == 0); + g_assert_true (gcry_mpi_cmp (check, p) == 0); gcry_mpi_release (check); gcry = gcry_mpi_scan (&check, GCRYMPI_FMT_USG, base, n_base, NULL); - g_assert (gcry == 0); - g_assert (gcry_mpi_cmp (check, g) == 0); + g_assert_true (gcry == 0); + g_assert_true (gcry_mpi_cmp (check, g) == 0); gcry_mpi_release (check); gcry_mpi_release (p); @@ -182,7 +182,7 @@ test_default_bad (void) gcry_mpi_t p, g; ret = egg_dh_default_params ("bad-name", &p, &g); - g_assert (!ret); + g_assert_false (ret); } int diff --git a/egg/test-hex.c b/egg/test-hex.c index 6bb8c5b..a7cc46d 100644 --- a/egg/test-hex.c +++ b/egg/test-hex.c @@ -38,7 +38,7 @@ test_encode (void) gchar *hex; hex = egg_hex_encode (TEST_DATA, sizeof (TEST_DATA)); - g_assert (hex); + g_assert_nonnull (hex); g_assert_cmpstr (hex, ==, TEST_HEX); g_free (hex); @@ -51,14 +51,14 @@ test_encode_spaces (void) /* Encode without spaces */ hex = egg_hex_encode_full (TEST_DATA, sizeof (TEST_DATA), TRUE, 0, 0); - g_assert (hex); + g_assert_nonnull (hex); g_assert_cmpstr (hex, ==, TEST_HEX); g_free (hex); /* Encode with spaces */ hex = egg_hex_encode_full (TEST_DATA, sizeof (TEST_DATA), TRUE, " ", 1); - g_assert (hex); + g_assert_nonnull (hex); g_assert_cmpstr (hex, ==, TEST_HEX_DELIM); g_free (hex); @@ -71,22 +71,22 @@ test_decode (void) gsize n_data; data = egg_hex_decode (TEST_HEX, -1, &n_data); - g_assert (data); - g_assert (n_data == sizeof (TEST_DATA)); - g_assert (memcmp (data, TEST_DATA, n_data) == 0); + g_assert_nonnull (data); + g_assert_cmpuint (n_data, ==, sizeof (TEST_DATA)); + g_assert_true (memcmp (data, TEST_DATA, n_data) == 0); g_free (data); /* Nothing in, empty out */ data = egg_hex_decode ("AB", 0, &n_data); - g_assert (data); - g_assert (n_data == 0); + g_assert_nonnull (data); + g_assert_cmpuint (n_data, ==, 0); g_free (data); /* Delimited*/ data = egg_hex_decode_full (TEST_HEX_DELIM, -1, " ", 1, &n_data); - g_assert (data); - g_assert (n_data == sizeof (TEST_DATA)); - g_assert (memcmp (data, TEST_DATA, n_data) == 0); + g_assert_nonnull (data); + g_assert_cmpuint (n_data, ==, sizeof (TEST_DATA)); + g_assert_true (memcmp (data, TEST_DATA, n_data) == 0); g_free (data); } @@ -98,15 +98,15 @@ test_decode_fail (void) /* Invalid input, null out */ data = egg_hex_decode ("AB", 1, &n_data); - g_assert (!data); + g_assert_null (data); /* Bad characters, null out */ data = egg_hex_decode ("ABXX", -1, &n_data); - g_assert (!data); + g_assert_null (data); /* Not Delimited, null out*/ data = egg_hex_decode_full ("ABABAB", -1, ":", 1, &n_data); - g_assert (!data); + g_assert_null (data); } int diff --git a/egg/test-hkdf.c b/egg/test-hkdf.c index b54cb8a..5114914 100644 --- a/egg/test-hkdf.c +++ b/egg/test-hkdf.c @@ -65,7 +65,7 @@ test_hkdf_test_case_1 (void) salt, sizeof (salt), info, sizeof (info), buffer, sizeof (buffer)); - g_assert (ret); + g_assert_true (ret); egg_assert_cmpmem (buffer, sizeof (buffer), ==, okm, sizeof (okm)); } @@ -128,7 +128,7 @@ test_hkdf_test_case_2 (void) salt, sizeof (salt), info, sizeof (info), buffer, sizeof (buffer)); - g_assert (ret); + g_assert_true (ret); egg_assert_cmpmem (buffer, sizeof (buffer), ==, okm, sizeof (okm)); } @@ -161,7 +161,7 @@ test_hkdf_test_case_3 (void) salt, sizeof (salt), info, sizeof (info), buffer, sizeof (buffer)); - g_assert (ret); + g_assert_true (ret); egg_assert_cmpmem (buffer, sizeof (buffer), ==, okm, sizeof (okm)); } @@ -195,7 +195,7 @@ test_hkdf_test_case_4 (void) salt, sizeof (salt), info, sizeof (info), buffer, sizeof (buffer)); - g_assert (ret); + g_assert_true (ret); egg_assert_cmpmem (buffer, sizeof (buffer), ==, okm, sizeof (okm)); } @@ -258,7 +258,7 @@ test_hkdf_test_case_5 (void) salt, sizeof (salt), info, sizeof (info), buffer, sizeof (buffer)); - g_assert (ret); + g_assert_true (ret); egg_assert_cmpmem (buffer, sizeof (buffer), ==, okm, sizeof (okm)); } @@ -291,7 +291,7 @@ test_hkdf_test_case_6 (void) salt, sizeof (salt), info, sizeof (info), buffer, sizeof (buffer)); - g_assert (ret); + g_assert_true (ret); egg_assert_cmpmem (buffer, sizeof (buffer), ==, okm, sizeof (okm)); } @@ -323,7 +323,7 @@ test_hkdf_test_case_7 (void) salt, sizeof (salt), info, sizeof (info), buffer, sizeof (buffer)); - g_assert (ret); + g_assert_true (ret); egg_assert_cmpmem (buffer, sizeof (buffer), ==, okm, sizeof (okm)); } diff --git a/egg/test-secmem.c b/egg/test-secmem.c index a1e847a..10c28fc 100644 --- a/egg/test-secmem.c +++ b/egg/test-secmem.c @@ -71,13 +71,13 @@ test_alloc_free (void) gboolean ret; p = egg_secure_alloc_full ("tests", 512, 0); - g_assert (p != NULL); + g_assert_nonnull (p); g_assert_cmpint (G_MAXSIZE, ==, find_non_zero (p, 512)); memset (p, 0x67, 512); ret = egg_secure_check (p); - g_assert (ret == TRUE); + g_assert_true (ret); egg_secure_free_full (p, 0); } @@ -89,12 +89,12 @@ test_realloc_across (void) /* Tiny allocation */ p = egg_secure_realloc_full ("tests", NULL, 1088, 0); - g_assert (p != NULL); + g_assert_nonnull (p); g_assert_cmpint (G_MAXSIZE, ==, find_non_zero (p, 1088)); /* Reallocate to a large one, will have to have changed blocks */ p2 = egg_secure_realloc_full ("tests", p, 16200, 0); - g_assert (p2 != NULL); + g_assert_nonnull (p2); g_assert_cmpint (G_MAXSIZE, ==, find_non_zero (p2, 16200)); egg_secure_free (p2); @@ -107,19 +107,19 @@ test_alloc_two (void) gboolean ret; p2 = egg_secure_alloc_full ("tests", 4, 0); - g_assert (p2 != NULL); + g_assert_nonnull (p2); g_assert_cmpint (G_MAXSIZE, ==, find_non_zero (p2, 4)); memset (p2, 0x67, 4); p = egg_secure_alloc_full ("tests", 16200, 0); - g_assert (p != NULL); + g_assert_nonnull (p); g_assert_cmpint (G_MAXSIZE, ==, find_non_zero (p, 16200)); memset (p, 0x67, 16200); ret = egg_secure_check (p); - g_assert (ret == TRUE); + g_assert_true (ret); egg_secure_free_full (p2, 0); egg_secure_free_full (p, 0); @@ -135,19 +135,19 @@ test_realloc (void) len = strlen (str) + 1; p = egg_secure_realloc_full ("tests", NULL, len, 0); - g_assert (p != NULL); + g_assert_nonnull (p); g_assert_cmpint (G_MAXSIZE, ==, find_non_zero (p, len)); strcpy ((gchar*)p, str); p2 = egg_secure_realloc_full ("tests", p, 512, 0); - g_assert (p2 != NULL); + g_assert_nonnull (p2); g_assert_cmpint (G_MAXSIZE, ==, find_non_zero (((gchar*)p2) + len, 512 - len)); - g_assert (strcmp (p2, str) == 0); + g_assert_cmpstr (p2, ==, str); p = egg_secure_realloc_full ("tests", p2, 0, 0); - g_assert (p == NULL); + g_assert_null (p); } static void @@ -181,24 +181,24 @@ test_multialloc (void) case 0: /* Allocate some memory */ size = g_random_int_range (1, 16384); data = egg_secure_alloc (size); - g_assert (data != NULL); + g_assert_nonnull (data); memset (data, 0xCAFEBABE, size); g_ptr_array_add (memory, data); break; case 1: /* Reallocate some memory */ index = g_random_int_range (0, memory->len); data = g_ptr_array_index (memory, index); - g_assert (data != NULL); + g_assert_nonnull (data); size = g_random_int_range (1, 16384); data = egg_secure_realloc (data, size); - g_assert (data != NULL); + g_assert_nonnull (data); memset (data, 0xCAFEBABE, size); g_ptr_array_index (memory, index) = data; break; case 2: /* Free some memory */ index = g_random_int_range (0, memory->len); data = g_ptr_array_remove_index_fast (memory, index); - g_assert (data != NULL); + g_assert_nonnull (data); egg_secure_free (data); break; default: @@ -211,7 +211,7 @@ test_multialloc (void) break; } - g_assert (memory->len == 0); + g_assert_true (memory->len == 0); g_ptr_array_free (memory, TRUE); egg_secure_warnings = 1; @@ -223,12 +223,12 @@ test_clear (void) gpointer p; p = egg_secure_alloc_full ("tests", 188, 0); - g_assert (p != NULL); + g_assert_nonnull (p); memset (p, 0x89, 188); - g_assert (memchr (p, 0x89, 188) == p); + g_assert_true (memchr (p, 0x89, 188) == p); egg_secure_clear (p, 188); - g_assert (memchr (p, 0x89, 188) == NULL); + g_assert_null (memchr (p, 0x89, 188)); egg_secure_free_full (p, 0); } @@ -239,13 +239,13 @@ test_strclear (void) gchar *str; str = egg_secure_strdup ("secret"); - g_assert (str != NULL); + g_assert_nonnull (str); g_assert_cmpuint (strlen (str), ==, 6); - g_assert (strchr (str, 't') == str + 5); + g_assert_true (strchr (str, 't') == str + 5); egg_secure_strclear (str); g_assert_cmpuint (strlen (str), ==, 6); - g_assert (strchr (str, 't') == NULL); + g_assert_null (strchr (str, 't')); egg_secure_free_full (str, 0); } diff --git a/libsecret/test-attributes.c b/libsecret/test-attributes.c index 192329d..c1c8215 100644 --- a/libsecret/test-attributes.c +++ b/libsecret/test-attributes.c @@ -65,7 +65,7 @@ test_build_unknown (void) "string", "four", "even", TRUE, NULL); - g_assert (attributes == NULL); + g_assert_null (attributes); return; } @@ -85,7 +85,7 @@ test_build_null_string (void) "string", NULL, "even", TRUE, NULL); - g_assert (attributes == NULL); + g_assert_null (attributes); return; } @@ -105,7 +105,7 @@ test_build_non_utf8_string (void) "string", "\xfftest", "even", TRUE, NULL); - g_assert (attributes == NULL); + g_assert_null (attributes); return; } @@ -123,7 +123,7 @@ test_build_bad_type (void) attributes = secret_attributes_build (&MOCK_SCHEMA, "bad-type", "test", NULL); - g_assert (attributes == NULL); + g_assert_null (attributes); return; } @@ -144,7 +144,7 @@ test_validate_schema (void) g_hash_table_replace (attributes, "xdg:schema", "org.mock.Schema"); ret = _secret_attributes_validate (&MOCK_SCHEMA, attributes, G_STRFUNC, TRUE); - g_assert (ret == TRUE); + g_assert_true (ret); g_hash_table_unref (attributes); } @@ -162,7 +162,7 @@ test_validate_schema_bad (void) g_hash_table_replace (attributes, "xdg:schema", "mismatched.Schema"); ret = _secret_attributes_validate (&MOCK_SCHEMA, attributes, G_STRFUNC, TRUE); - g_assert (ret == FALSE); + g_assert_false (ret); g_hash_table_unref (attributes); return; @@ -183,7 +183,7 @@ test_validate_libgnomekeyring (void) g_hash_table_replace (attributes, "gkr:compat", "blah-dee-blah"); ret = _secret_attributes_validate (&MOCK_SCHEMA, attributes, G_STRFUNC, TRUE); - g_assert (ret == TRUE); + g_assert_true (ret); g_hash_table_unref (attributes); } diff --git a/libsecret/test-collection.c b/libsecret/test-collection.c index 662c41d..94c6d41 100644 --- a/libsecret/test-collection.c +++ b/libsecret/test-collection.c @@ -64,7 +64,7 @@ teardown (Test *test, { g_object_unref (test->service); secret_service_disconnect (); - g_assert (test->service == NULL); + g_assert_null (test->service); mock_service_stop (); } @@ -75,8 +75,8 @@ on_async_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -87,8 +87,8 @@ on_notify_stop (GObject *obj, gpointer user_data) { guint *sigs = user_data; - g_assert (sigs != NULL); - g_assert (*sigs > 0); + g_assert_nonnull (sigs); + g_assert_true (*sigs > 0); if (--(*sigs) == 0) egg_test_wait_stop (); } @@ -109,7 +109,7 @@ test_new_sync (Test *test, g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path); g_object_unref (collection); - g_assert (collection == NULL); + g_assert_null (collection); } static void @@ -123,7 +123,7 @@ test_new_async (Test *test, secret_collection_new_for_dbus_path (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -135,7 +135,7 @@ test_new_async (Test *test, g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path); g_object_unref (collection); - g_assert (collection == NULL); + g_assert_null (collection); } static void @@ -149,7 +149,7 @@ test_new_sync_noexist (Test *test, collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (collection == NULL); + g_assert_null (collection); g_clear_error (&error); } @@ -164,13 +164,13 @@ test_new_async_noexist (Test *test, secret_collection_new_for_dbus_path (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); collection = secret_collection_new_for_dbus_path_finish (result, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (collection == NULL); + g_assert_null (collection); g_clear_error (&error); g_object_unref (result); } @@ -191,13 +191,13 @@ test_for_alias_sync (Test *test, collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)); g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english"); g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_NONE); - g_assert (secret_collection_get_items (collection) == NULL); + g_assert_null (secret_collection_get_items (collection)); g_object_unref (collection); collection = secret_collection_for_alias_sync (test->service, "unknown", SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); - g_assert (collection == NULL); + g_assert_null (collection); } static void @@ -212,7 +212,7 @@ test_for_alias_async (Test *test, secret_collection_for_alias (test->service, "default", SECRET_COLLECTION_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); collection = secret_collection_for_alias_finish (result, &error); @@ -222,19 +222,19 @@ test_for_alias_async (Test *test, collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)); g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english"); g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_NONE); - g_assert (secret_collection_get_items (collection) == NULL); + g_assert_null (secret_collection_get_items (collection)); g_object_unref (collection); result = NULL; secret_collection_for_alias (test->service, "unknown", SECRET_COLLECTION_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); collection = secret_collection_for_alias_finish (result, &error); g_assert_no_error (error); - g_assert (collection == NULL); + g_assert_null (collection); g_object_unref (result); } @@ -256,7 +256,7 @@ test_for_alias_load_sync (Test *test, g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english"); g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_LOAD_ITEMS); items = secret_collection_get_items (collection); - g_assert (items != NULL); + g_assert_nonnull (items); g_list_free_full (items, g_object_unref); g_object_unref (collection); } @@ -274,7 +274,7 @@ test_for_alias_load_async (Test *test, secret_collection_for_alias (test->service, "default", SECRET_COLLECTION_LOAD_ITEMS, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); collection = secret_collection_for_alias_finish (result, &error); @@ -285,7 +285,7 @@ test_for_alias_load_async (Test *test, g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english"); g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_LOAD_ITEMS); items = secret_collection_get_items (collection); - g_assert (items != NULL); + g_assert_nonnull (items); g_list_free_full (items, g_object_unref); g_object_unref (collection); result = NULL; @@ -304,12 +304,12 @@ test_create_sync (Test *test, g_assert_no_error (error); g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection); - g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection")); + g_assert_true (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection")); g_assert_cmpstr_free (secret_collection_get_label (collection), ==, "Train"); - g_assert (secret_collection_get_locked (collection) == FALSE); + g_assert_false (secret_collection_get_locked (collection)); g_object_unref (collection); - g_assert (collection == NULL); + g_assert_null (collection); } static void @@ -323,7 +323,7 @@ test_create_async (Test *test, secret_collection_create (test->service, "Train", NULL, SECRET_COLLECTION_CREATE_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -332,12 +332,12 @@ test_create_async (Test *test, g_object_unref (result); g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection); - g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection")); + g_assert_true (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection")); g_assert_cmpstr_free (secret_collection_get_label (collection), ==, "Train"); - g_assert (secret_collection_get_locked (collection) == FALSE); + g_assert_false (secret_collection_get_locked (collection)); g_object_unref (collection); - g_assert (collection == NULL); + g_assert_null (collection); } static void @@ -357,7 +357,7 @@ test_properties (Test *test, SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); - g_assert (secret_collection_get_locked (collection) == FALSE); + g_assert_false (secret_collection_get_locked (collection)); g_assert_cmpuint (secret_collection_get_created (collection), <=, time (NULL)); g_assert_cmpuint (secret_collection_get_modified (collection), <=, time (NULL)); @@ -373,14 +373,14 @@ test_properties (Test *test, "service", &service, NULL); - g_assert (locked == FALSE); + g_assert_false (locked); g_assert_cmpuint (created, <=, time (NULL)); g_assert_cmpuint (modified, <=, time (NULL)); g_assert_cmpstr (label, ==, "Collection One"); g_free (label); - g_assert (service == test->service); + g_assert_true (service == test->service); g_object_unref (service); g_object_unref (collection); @@ -409,7 +409,7 @@ check_items_equal (GList *items, for (l = items; l != NULL; l = g_list_next (l)) { path = g_dbus_proxy_get_object_path (l->data); have_item = g_hash_table_remove (paths, path); - g_assert (have_item); + g_assert_true (have_item); } g_hash_table_destroy (paths); @@ -484,7 +484,7 @@ test_items_empty_async (Test *test, secret_collection_new_for_dbus_path (test->service, collection_path, SECRET_COLLECTION_LOAD_ITEMS, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -523,7 +523,7 @@ test_set_label_sync (Test *test, ret = secret_collection_set_label_sync (collection, "Another label", NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); label = secret_collection_get_label (collection); g_assert_cmpstr (label, ==, "Another label"); @@ -552,13 +552,13 @@ test_set_label_async (Test *test, g_free (label); secret_collection_set_label (collection, "Another label", NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_collection_set_label_finish (collection, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); label = secret_collection_get_label (collection); @@ -581,7 +581,7 @@ test_set_label_prop (Test *test, secret_collection_new_for_dbus_path (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); collection = secret_collection_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); @@ -619,14 +619,14 @@ test_delete_sync (Test *test, ret = secret_collection_delete_sync (collection, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (collection); collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (collection == NULL); + g_assert_null (collection); g_clear_error (&error); } @@ -645,21 +645,21 @@ test_delete_async (Test *test, g_assert_no_error (error); secret_collection_delete (collection, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_collection_delete_finish (collection, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (collection); collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (collection == NULL); + g_assert_null (collection); g_clear_error(&error); } @@ -685,10 +685,10 @@ test_search_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); @@ -716,19 +716,19 @@ test_search_async (Test *test, SECRET_SEARCH_NONE, NULL, on_async_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_collection_search_finish (collection, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); @@ -767,19 +767,19 @@ test_search_all_sync (Test *test, items = g_list_sort (items, sort_by_object_path); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/english/2"); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next != NULL); + g_assert_nonnull (items->next->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->next->data), ==, "/org/freedesktop/secrets/collection/english/3"); - g_assert (secret_item_get_secret (items->next->next->data) == NULL); + g_assert_null (secret_item_get_secret (items->next->next->data)); - g_assert (items->next->next->next == NULL); + g_assert_null (items->next->next->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); @@ -806,30 +806,30 @@ test_search_all_async (Test *test, SECRET_SEARCH_ALL, NULL, on_async_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_collection_search_finish (collection, result, &error); g_assert_no_error (error); g_object_unref (result); items = g_list_sort (items, sort_by_object_path); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/english/2"); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next != NULL); + g_assert_nonnull (items->next->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->next->data), ==, "/org/freedesktop/secrets/collection/english/3"); - g_assert (secret_item_get_secret (items->next->next->data) == NULL); + g_assert_null (secret_item_get_secret (items->next->next->data)); - g_assert (items->next->next->next == NULL); + g_assert_null (items->next->next->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); @@ -857,12 +857,12 @@ test_search_unlock_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->data) == FALSE); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_false (secret_item_get_locked (items->data)); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); @@ -890,21 +890,21 @@ test_search_unlock_async (Test *test, SECRET_SEARCH_UNLOCK, NULL, on_async_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_collection_search_finish (collection, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->data) == FALSE); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_false (secret_item_get_locked (items->data)); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); @@ -934,14 +934,14 @@ test_search_secrets_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); + g_assert_false (secret_item_get_locked (items->data)); value = secret_item_get_secret (items->data); - g_assert (value != NULL); + g_assert_nonnull (value); secret_value_unref (value); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); @@ -970,23 +970,23 @@ test_search_secrets_async (Test *test, SECRET_SEARCH_LOAD_SECRETS, NULL, on_async_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_collection_search_finish (collection, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); + g_assert_false (secret_item_get_locked (items->data)); value = secret_item_get_secret (items->data); - g_assert (value != NULL); + g_assert_nonnull (value); secret_value_unref (value); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); g_object_unref (collection); diff --git a/libsecret/test-item.c b/libsecret/test-item.c index ef156aa..2ef6f0e 100644 --- a/libsecret/test-item.c +++ b/libsecret/test-item.c @@ -65,7 +65,7 @@ teardown (Test *test, { g_object_unref (test->service); secret_service_disconnect (); - g_assert (test->service == NULL); + g_assert_null (test->service); mock_service_stop (); } @@ -76,8 +76,8 @@ on_async_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -88,8 +88,8 @@ on_notify_stop (GObject *obj, gpointer user_data) { guint *sigs = user_data; - g_assert (sigs != NULL); - g_assert (*sigs > 0); + g_assert_nonnull (sigs); + g_assert_true (*sigs > 0); if (--(*sigs) == 0) egg_test_wait_stop (); } @@ -120,7 +120,7 @@ test_new_sync_noexist (Test *test, item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (item == NULL); + g_assert_null (item); g_clear_error (&error); } @@ -135,7 +135,7 @@ test_new_async (Test *test, secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -159,13 +159,13 @@ test_new_async_noexist (Test *test, secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); item = secret_item_new_for_dbus_path_finish (result, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (item == NULL); + g_assert_null (item); g_clear_error (&error); g_object_unref (result); } @@ -203,12 +203,12 @@ test_create_sync (Test *test, g_object_unref (collection); secret_value_unref (value); - g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path)); + g_assert_true (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path)); g_assert_cmpstr_free (secret_item_get_label (item), ==, "Tunnel"); - g_assert (secret_item_get_locked (item) == FALSE); + g_assert_false (secret_item_get_locked (item)); g_object_unref (item); - g_assert (item == NULL); + g_assert_null (item); } static void @@ -249,12 +249,12 @@ test_create_async (Test *test, g_object_unref (result); g_object_add_weak_pointer (G_OBJECT (item), (gpointer *)&item); - g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path)); + g_assert_true (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path)); g_assert_cmpstr_free (secret_item_get_label (item), ==, "Tunnel"); - g_assert (secret_item_get_locked (item) == FALSE); + g_assert_false (secret_item_get_locked (item)); g_object_unref (item); - g_assert (item == NULL); + g_assert_null (item); } static void @@ -274,7 +274,7 @@ test_properties (Test *test, item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_no_error (error); - g_assert (secret_item_get_locked (item) == FALSE); + g_assert_false (secret_item_get_locked (item)); g_assert_cmpuint (secret_item_get_created (item), <=, time (NULL)); g_assert_cmpuint (secret_item_get_modified (item), <=, time (NULL)); @@ -298,7 +298,7 @@ test_properties (Test *test, "service", &service, NULL); - g_assert (locked == FALSE); + g_assert_false (locked); g_assert_cmpuint (created, <=, time (NULL)); g_assert_cmpuint (modified, <=, time (NULL)); @@ -311,7 +311,7 @@ test_properties (Test *test, g_assert_cmpuint (g_hash_table_size (attributes), ==, 4); g_hash_table_unref (attributes); - g_assert (service == test->service); + g_assert_true (service == test->service); g_object_unref (service); g_object_unref (item); @@ -336,7 +336,7 @@ test_set_label_sync (Test *test, ret = secret_item_set_label_sync (item, "Another label", NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); label = secret_item_get_label (item); g_assert_cmpstr (label, ==, "Another label"); @@ -364,13 +364,13 @@ test_set_label_async (Test *test, g_free (label); secret_item_set_label (item, "Another label", NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_item_set_label_finish (item, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); label = secret_item_get_label (item); @@ -392,7 +392,7 @@ test_set_label_prop (Test *test, gchar *label; secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); item = secret_item_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); @@ -451,7 +451,7 @@ test_set_attributes_sync (Test *test, ret = secret_item_set_attributes_sync (item, &MOCK_SCHEMA, attributes, NULL, &error); g_hash_table_unref (attributes); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); attributes = secret_item_get_attributes (item); g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "five"); @@ -498,14 +498,14 @@ test_set_attributes_async (Test *test, g_hash_table_insert (attributes, "string", "five"); g_hash_table_insert (attributes, "number", "5"); secret_item_set_attributes (item, &MOCK_SCHEMA, attributes, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); g_hash_table_unref (attributes); egg_test_wait (); ret = secret_item_set_attributes_finish (item, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); attributes = secret_item_get_attributes (item); @@ -534,7 +534,7 @@ test_set_attributes_prop (Test *test, guint sigs = 2; secret_item_new_for_dbus_path (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); item = secret_item_new_for_dbus_path_finish (result, &error); g_assert_no_error (error); @@ -587,14 +587,14 @@ test_load_secret_sync (Test *test, g_assert_no_error (error); value = secret_item_get_secret (item); - g_assert (value == NULL); + g_assert_null (value); ret = secret_item_load_secret_sync (item, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); value = secret_item_get_secret (item); - g_assert (value != NULL); + g_assert_nonnull (value); data = secret_value_get (value, &length); egg_assert_cmpmem (data, length, ==, "111", 3); @@ -621,20 +621,20 @@ test_load_secret_async (Test *test, g_assert_no_error (error); value = secret_item_get_secret (item); - g_assert (value == NULL); + g_assert_null (value); secret_item_load_secret (item, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_item_load_secret_finish (item, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); value = secret_item_get_secret (item); - g_assert (value != NULL); + g_assert_nonnull (value); data = secret_value_get (value, &length); egg_assert_cmpmem (data, length, ==, "111", 3); @@ -664,19 +664,19 @@ test_set_secret_sync (Test *test, ret = secret_item_set_secret_sync (item, value, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); check = secret_item_get_secret (item); - g_assert (check == value); + g_assert_true (check == value); secret_value_unref (check); secret_value_unref (value); ret = secret_item_load_secret_sync (item, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); value = secret_item_get_secret (item); - g_assert (value != NULL); + g_assert_nonnull (value); data = secret_value_get (value, &length); egg_assert_cmpmem (data, length, ==, "Sinking", 7); @@ -712,24 +712,24 @@ test_secrets_sync (Test *test, ret = secret_item_load_secrets_sync (items, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); value = secret_item_get_secret (item_one); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "111"); secret_value_unref (value); value = secret_item_get_secret (item_two); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "222"); secret_value_unref (value); value = secret_item_get_secret (item_three); - g_assert (value == NULL); + g_assert_null (value); g_list_free_full (items, g_object_unref); } @@ -767,31 +767,31 @@ test_secrets_async (Test *test, secret_item_load_secrets (items, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_item_load_secrets_finish (result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (ret == TRUE); + g_assert_true (ret); value = secret_item_get_secret (item_one); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "111"); secret_value_unref (value); value = secret_item_get_secret (item_two); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "222"); secret_value_unref (value); value = secret_item_get_secret (item_three); - g_assert (value == NULL); + g_assert_null (value); g_object_unref (item_one); g_object_unref (item_two); @@ -813,13 +813,13 @@ test_delete_sync (Test *test, ret = secret_item_delete_sync (item, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (item); item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (item == NULL); + g_assert_null (item); g_clear_error (&error); } @@ -837,20 +837,20 @@ test_delete_async (Test *test, g_assert_no_error (error); secret_item_delete (item, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_item_delete_finish (item, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); g_object_unref (item); item = secret_item_new_for_dbus_path_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert (item == NULL); + g_assert_null (item); g_clear_error (&error); } diff --git a/libsecret/test-methods.c b/libsecret/test-methods.c index e318cc8..c294848 100644 --- a/libsecret/test-methods.c +++ b/libsecret/test-methods.c @@ -92,7 +92,7 @@ teardown (Test *test, g_object_unref (test->service); secret_service_disconnect (); - g_assert (test->service == NULL); + g_assert_null (test->service); teardown_mock (test, unused); } @@ -103,8 +103,8 @@ on_complete_get_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -125,10 +125,10 @@ test_search_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); } @@ -148,19 +148,19 @@ test_search_async (Test *test, SECRET_SEARCH_NONE, NULL, on_complete_get_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_service_search_finish (test->service, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (items->next == NULL); + g_assert_null (items->next); g_list_free_full (items, g_object_unref); } @@ -180,17 +180,17 @@ test_search_all_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_false (secret_item_get_locked (items->data)); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->next->data) == TRUE); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_true (secret_item_get_locked (items->next->data)); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next == NULL); + g_assert_null (items->next->next); g_list_free_full (items, g_object_unref); } @@ -210,26 +210,26 @@ test_search_all_async (Test *test, SECRET_SEARCH_ALL, NULL, on_complete_get_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_service_search_finish (test->service, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_false (secret_item_get_locked (items->data)); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->next->data) == TRUE); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_true (secret_item_get_locked (items->next->data)); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next == NULL); + g_assert_null (items->next->next); g_list_free_full (items, g_object_unref); } @@ -250,17 +250,17 @@ test_search_unlock_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_false (secret_item_get_locked (items->data)); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->next->data) == FALSE); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_false (secret_item_get_locked (items->next->data)); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next == NULL); + g_assert_null (items->next->next); g_list_free_full (items, g_object_unref); } @@ -280,26 +280,26 @@ test_search_unlock_async (Test *test, SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK, NULL, on_complete_get_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_service_search_finish (test->service, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); - g_assert (secret_item_get_secret (items->data) == NULL); + g_assert_false (secret_item_get_locked (items->data)); + g_assert_null (secret_item_get_secret (items->data)); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->next->data) == FALSE); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_false (secret_item_get_locked (items->next->data)); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next == NULL); + g_assert_null (items->next->next); g_list_free_full (items, g_object_unref); } @@ -321,19 +321,19 @@ test_search_secrets_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); + g_assert_false (secret_item_get_locked (items->data)); value = secret_item_get_secret (items->data); - g_assert (value != NULL); + g_assert_nonnull (value); secret_value_unref (value); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->next->data) == TRUE); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_true (secret_item_get_locked (items->next->data)); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next == NULL); + g_assert_null (items->next->next); g_list_free_full (items, g_object_unref); } @@ -354,28 +354,28 @@ test_search_secrets_async (Test *test, SECRET_SEARCH_ALL | SECRET_SEARCH_LOAD_SECRETS, NULL, on_complete_get_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); items = secret_service_search_finish (test->service, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (items != NULL); + g_assert_nonnull (items); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1"); - g_assert (secret_item_get_locked (items->data) == FALSE); + g_assert_false (secret_item_get_locked (items->data)); value = secret_item_get_secret (items->data); - g_assert (value != NULL); + g_assert_nonnull (value); secret_value_unref (value); - g_assert (items->next != NULL); + g_assert_nonnull (items->next); g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (secret_item_get_locked (items->next->data) == TRUE); - g_assert (secret_item_get_secret (items->next->data) == NULL); + g_assert_true (secret_item_get_locked (items->next->data)); + g_assert_null (secret_item_get_secret (items->next->data)); - g_assert (items->next->next == NULL); + g_assert_null (items->next->next); g_list_free_full (items, g_object_unref); } @@ -398,11 +398,11 @@ test_lock_sync (Test *test, ret = secret_service_lock_sync (test->service, objects, NULL, &locked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (locked != NULL); - g_assert (locked->data == collection); - g_assert (locked->next == NULL); + g_assert_nonnull (locked); + g_assert_true (locked->data == collection); + g_assert_null (locked->next); g_list_free_full (locked, g_object_unref); g_list_free (objects); @@ -428,11 +428,11 @@ test_unlock_sync (Test *test, ret = secret_service_unlock_sync (test->service, objects, NULL, &unlocked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (unlocked != NULL); - g_assert (unlocked->data == collection); - g_assert (unlocked->next == NULL); + g_assert_nonnull (unlocked); + g_assert_true (unlocked->data == collection); + g_assert_null (unlocked->next); g_list_free_full (unlocked, g_object_unref); g_list_free (objects); @@ -456,7 +456,7 @@ test_clear_sync (Test *test, ret = secret_service_clear_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_hash_table_unref (attributes); } @@ -480,13 +480,13 @@ test_clear_async (Test *test, on_complete_get_result, &result); g_hash_table_unref (attributes); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_service_clear_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); } @@ -510,7 +510,7 @@ test_clear_locked (Test *test, g_hash_table_unref (attributes); g_assert_no_error (error); - g_assert (ret == FALSE); + g_assert_false (ret); } static void @@ -531,7 +531,7 @@ test_clear_no_match (Test *test, g_hash_table_unref (attributes); g_assert_no_error (error); - g_assert (ret == FALSE); + g_assert_false (ret); } static void @@ -550,7 +550,7 @@ test_clear_no_name (Test *test, /* Shouldn't match anything, because no item with 5 in mock schema */ ret = secret_service_clear_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &error); g_assert_no_error (error); - g_assert (ret == FALSE); + g_assert_false (ret); /* We need this collection unlocked for the next test */ secret_service_unlock_dbus_paths_sync (test->service, paths, NULL, NULL, &error); @@ -559,7 +559,7 @@ test_clear_no_name (Test *test, /* We have an item with 5 in prime schema, but should match anyway becase of flags */ ret = secret_service_clear_sync (test->service, &NO_NAME_SCHEMA, attributes, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_hash_table_unref (attributes); } @@ -584,7 +584,7 @@ test_lookup_sync (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (value != NULL); + g_assert_nonnull (value); g_assert_cmpstr (secret_value_get (value, &length), ==, "111"); g_assert_cmpuint (length, ==, 3); @@ -610,7 +610,7 @@ test_lookup_async (Test *test, secret_service_lookup (test->service, &MOCK_SCHEMA, attributes, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); g_hash_table_unref (attributes); egg_test_wait (); @@ -618,7 +618,7 @@ test_lookup_async (Test *test, value = secret_service_lookup_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (value != NULL); + g_assert_nonnull (value); g_assert_cmpstr (secret_value_get (value, &length), ==, "111"); g_assert_cmpuint (length, ==, 3); @@ -646,7 +646,7 @@ test_lookup_locked (Test *test, g_assert_no_error (error); g_hash_table_unref (attributes); - g_assert (value != NULL); + g_assert_nonnull (value); g_assert_cmpstr (secret_value_get (value, &length), ==, "3333"); g_assert_cmpuint (length, ==, 4); @@ -670,7 +670,7 @@ test_lookup_no_match (Test *test, value = secret_service_lookup_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &error); g_assert_no_error (error); - g_assert (value == NULL); + g_assert_null (value); g_hash_table_unref (attributes); } @@ -690,14 +690,14 @@ test_lookup_no_name (Test *test, /* should return null, because nothing with mock schema and 5 */ value = secret_service_lookup_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &error); g_assert_no_error (error); - g_assert (value == NULL); + g_assert_null (value); /* should return an item, because we have a prime schema with 5, and flags not to match name */ value = secret_service_lookup_sync (test->service, &NO_NAME_SCHEMA, attributes, NULL, &error); g_assert_no_error (error); - g_assert (value != NULL); + g_assert_nonnull (value); g_assert_cmpstr (secret_value_get (value, &length), ==, "555"); g_assert_cmpuint (length, ==, 3); @@ -737,17 +737,17 @@ test_store_sync (Test *test, ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &paths, NULL, &error); g_hash_table_unref (attributes); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (paths != NULL); - g_assert (paths[0] != NULL); - g_assert (paths[1] == NULL); + g_assert_nonnull (paths); + g_assert_nonnull (paths[0]); + g_assert_null (paths[1]); value = secret_service_get_secret_for_dbus_path_sync (test->service, paths[0], NULL, &error); g_assert_no_error (error); - g_assert (value != NULL); + g_assert_nonnull (value); g_assert_cmpstr (secret_value_get (value, &length), ==, "apassword"); g_assert_cmpuint (length, ==, 9); @@ -790,11 +790,11 @@ test_store_replace (Test *test, ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &paths, NULL, &error); g_hash_table_unref (attributes); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (paths != NULL); - g_assert (paths[0] != NULL); - g_assert (paths[1] == NULL); + g_assert_nonnull (paths); + g_assert_nonnull (paths[0]); + g_assert_null (paths[1]); g_strfreev (paths); } @@ -820,7 +820,7 @@ test_store_async (Test *test, secret_service_store (test->service, &MOCK_SCHEMA, attributes, collection_path, "New Item Label", value, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); secret_value_unref (value); g_hash_table_unref (attributes); @@ -838,17 +838,17 @@ test_store_async (Test *test, ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &paths, NULL, &error); g_hash_table_unref (attributes); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (paths != NULL); - g_assert (paths[0] != NULL); - g_assert (paths[1] == NULL); + g_assert_nonnull (paths); + g_assert_nonnull (paths[0]); + g_assert_null (paths[1]); value = secret_service_get_secret_for_dbus_path_sync (test->service, paths[0], NULL, &error); g_assert_no_error (error); - g_assert (value != NULL); + g_assert_nonnull (value); g_assert_cmpstr (secret_value_get (value, &length), ==, "apassword"); g_assert_cmpuint (length, ==, 9); @@ -887,17 +887,17 @@ test_store_no_default (Test *test, ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &paths, NULL, &error); g_hash_table_unref (attributes); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (paths != NULL); - g_assert (paths[0] != NULL); - g_assert (paths[1] == NULL); + g_assert_nonnull (paths); + g_assert_nonnull (paths[0]); + g_assert_null (paths[1]); value = secret_service_get_secret_for_dbus_path_sync (test->service, paths[0], NULL, &error); g_assert_no_error (error); - g_assert (value != NULL); + g_assert_nonnull (value); g_assert_cmpstr (secret_value_get (value, &length), ==, "apassword"); g_assert_cmpuint (length, ==, 9); @@ -916,17 +916,17 @@ test_set_alias_sync (Test *test, blah = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); - g_assert (blah == NULL); + g_assert_null (blah); collection = secret_collection_new_for_dbus_path_sync (test->service, "/org/freedesktop/secrets/collection/english", SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); - g_assert (SECRET_IS_COLLECTION (collection)); + g_assert_true (SECRET_IS_COLLECTION (collection)); ret = secret_service_set_alias_sync (test->service, "blah", collection, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); blah = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); @@ -935,11 +935,11 @@ test_set_alias_sync (Test *test, ret = secret_service_set_alias_sync (test->service, "blah", NULL, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); blah = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); - g_assert (blah == NULL); + g_assert_null (blah); g_object_unref (collection); } diff --git a/libsecret/test-password.c b/libsecret/test-password.c index 45d5a3c..ab95859 100644 --- a/libsecret/test-password.c +++ b/libsecret/test-password.c @@ -75,8 +75,8 @@ on_complete_get_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -113,7 +113,7 @@ test_lookup_async (Test *test, "string", "one", "number", 1, NULL); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -137,7 +137,7 @@ test_lookup_no_name (Test *test, "number", 5, NULL); g_assert_no_error (error); - g_assert (password == NULL); + g_assert_null (password); /* should return an item, because we have a prime schema with 5, and flags not to match name */ password = secret_password_lookup_sync (&NO_NAME_SCHEMA, NULL, &error, @@ -167,7 +167,7 @@ test_store_sync (Test *test, NULL); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); password = secret_password_lookup_nonpageable_sync (&MOCK_SCHEMA, NULL, &error, "string", "twelve", @@ -195,13 +195,13 @@ test_store_async (Test *test, "string", "twelve", "number", 12, NULL); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_password_store_finish (result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); password = secret_password_lookup_nonpageable_sync (&MOCK_SCHEMA, NULL, &error, @@ -235,7 +235,7 @@ test_store_unlock (Test *test, collection = secret_collection_new_for_dbus_path_sync (service, collection_path, SECRET_COLLECTION_NONE, NULL, &error); g_assert_no_error (error); - g_assert (secret_collection_get_locked (collection) == FALSE); + g_assert_false (secret_collection_get_locked (collection)); /* Lock it, use async, so collection properties update */ objects = g_list_append (NULL, collection); @@ -247,7 +247,7 @@ test_store_unlock (Test *test, g_list_free (objects); /* Check collection state */ - g_assert (secret_collection_get_locked (collection) == TRUE); + g_assert_true (secret_collection_get_locked (collection)); /* Store the password, use async so collection properties update */ secret_password_store (&MOCK_SCHEMA, collection_path, "Label here", @@ -256,15 +256,15 @@ test_store_unlock (Test *test, "string", "twelve", "number", 12, NULL); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_password_store_finish (result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_clear_object (&result); /* Check collection state */ - g_assert (secret_collection_get_locked (collection) == FALSE); + g_assert_false (secret_collection_get_locked (collection)); password = secret_password_lookup_nonpageable_sync (&MOCK_SCHEMA, NULL, &error, @@ -293,7 +293,7 @@ test_delete_sync (Test *test, NULL); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); } static void @@ -311,13 +311,13 @@ test_delete_async (Test *test, "number", 1, NULL); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_password_clear_finish (result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); } @@ -336,7 +336,7 @@ test_clear_no_name (Test *test, "number", 5, NULL); g_assert_no_error (error); - g_assert (ret == FALSE); + g_assert_false (ret); /* We need this collection unlocked for the next test */ service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error); @@ -351,7 +351,7 @@ test_clear_no_name (Test *test, NULL); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); } static void diff --git a/libsecret/test-paths.c b/libsecret/test-paths.c index b437298..8c32055 100644 --- a/libsecret/test-paths.c +++ b/libsecret/test-paths.c @@ -83,7 +83,7 @@ teardown (Test *test, g_object_unref (test->service); secret_service_disconnect (); - g_assert (test->service == NULL); + g_assert_null (test->service); teardown_mock (test, unused); } @@ -94,8 +94,8 @@ on_complete_get_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -116,12 +116,12 @@ test_search_paths_sync (Test *test, ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &unlocked, &locked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (locked); + g_assert_nonnull (locked); g_assert_cmpstr (locked[0], ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (unlocked); + g_assert_nonnull (unlocked); g_assert_cmpstr (unlocked[0], ==, "/org/freedesktop/secrets/collection/english/1"); g_strfreev (unlocked); @@ -148,17 +148,17 @@ test_search_paths_async (Test *test, on_complete_get_result, &result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_search_for_dbus_paths_finish (test->service, result, &unlocked, &locked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (locked); + g_assert_nonnull (locked); g_assert_cmpstr (locked[0], ==, "/org/freedesktop/secrets/collection/spanish/10"); - g_assert (unlocked); + g_assert_nonnull (unlocked); g_assert_cmpstr (unlocked[0], ==, "/org/freedesktop/secrets/collection/english/1"); g_strfreev (unlocked); @@ -184,33 +184,33 @@ test_search_paths_nulls (Test *test, ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, &paths, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); - g_assert (paths != NULL); + g_assert_true (ret); + g_assert_nonnull (paths); g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/english/1"); g_strfreev (paths); ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, NULL, &paths, &error); g_assert_no_error (error); - g_assert (ret == TRUE); - g_assert (paths != NULL); + g_assert_true (ret); + g_assert_nonnull (paths); g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/spanish/10"); g_strfreev (paths); ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL, NULL, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL, on_complete_get_result, &result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_search_for_dbus_paths_finish (test->service, result, &paths, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); - g_assert (paths != NULL); + g_assert_true (ret); + g_assert_nonnull (paths); g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/english/1"); g_strfreev (paths); g_clear_object (&result); @@ -218,12 +218,12 @@ test_search_paths_nulls (Test *test, secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL, on_complete_get_result, &result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_search_for_dbus_paths_finish (test->service, result, NULL, &paths, &error); g_assert_no_error (error); - g_assert (ret == TRUE); - g_assert (paths != NULL); + g_assert_true (ret); + g_assert_nonnull (paths); g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/spanish/10"); g_strfreev (paths); g_clear_object (&result); @@ -231,11 +231,11 @@ test_search_paths_nulls (Test *test, secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL, on_complete_get_result, &result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_search_for_dbus_paths_finish (test->service, result, NULL, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_clear_object (&result); g_hash_table_unref (attributes); @@ -254,7 +254,7 @@ test_secret_for_path_sync (Test *test, path = "/org/freedesktop/secrets/collection/english/1"; value = secret_service_get_secret_for_dbus_path_sync (test->service, path, NULL, &error); g_assert_no_error (error); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); @@ -280,12 +280,12 @@ test_secret_for_path_async (Test *test, path = "/org/freedesktop/secrets/collection/english/1"; secret_service_get_secret_for_dbus_path (test->service, path, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); value = secret_service_get_secret_for_dbus_path_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (value != NULL); + g_assert_nonnull (value); g_object_unref (result); password = secret_value_get (value, &length); @@ -322,17 +322,17 @@ test_secrets_for_paths_sync (Test *test, values = secret_service_get_secrets_for_dbus_paths_sync (test->service, paths, NULL, &error); g_assert_no_error (error); - g_assert (values != NULL); + g_assert_nonnull (values); g_assert_cmpuint (g_hash_table_size (values), ==, 2); value = g_hash_table_lookup (values, path_item_one); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "111"); value = g_hash_table_lookup (values, path_item_two); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "222"); @@ -364,24 +364,24 @@ test_secrets_for_paths_async (Test *test, secret_service_get_secrets_for_dbus_paths (test->service, paths, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); values = secret_service_get_secrets_for_dbus_paths_finish (test->service, result, &error); g_assert_no_error (error); g_object_unref (result); - g_assert (values != NULL); + g_assert_nonnull (values); g_assert_cmpuint (g_hash_table_size (values), ==, 2); value = g_hash_table_lookup (values, path_item_one); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "111"); value = g_hash_table_lookup (values, path_item_two); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 3); g_assert_cmpstr (password, ==, "222"); @@ -400,7 +400,7 @@ test_delete_for_path_sync (Test *test, ret = secret_service_delete_item_dbus_path_sync (test->service, path_item_one, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); } static void @@ -414,7 +414,7 @@ test_delete_for_path_sync_prompt (Test *test, ret = secret_service_delete_item_dbus_path_sync (test->service, path_item_one, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); } static void @@ -433,11 +433,11 @@ test_lock_paths_sync (Test *test, ret = secret_service_lock_dbus_paths_sync (test->service, paths, NULL, &locked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (locked != NULL); + g_assert_nonnull (locked); g_assert_cmpstr (locked[0], ==, collection_path); - g_assert (locked[1] == NULL); + g_assert_null (locked[1]); g_strfreev (locked); } @@ -457,11 +457,11 @@ test_lock_prompt_sync (Test *test, ret = secret_service_lock_dbus_paths_sync (test->service, paths, NULL, &locked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (locked != NULL); + g_assert_nonnull (locked); g_assert_cmpstr (locked[0], ==, collection_path); - g_assert (locked[1] == NULL); + g_assert_null (locked[1]); g_strfreev (locked); } @@ -481,11 +481,11 @@ test_unlock_paths_sync (Test *test, ret = secret_service_unlock_dbus_paths_sync (test->service, paths, NULL, &unlocked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (unlocked != NULL); + g_assert_nonnull (unlocked); g_assert_cmpstr (unlocked[0], ==, collection_path); - g_assert (unlocked[1] == NULL); + g_assert_null (unlocked[1]); g_strfreev (unlocked); } @@ -505,11 +505,11 @@ test_unlock_prompt_sync (Test *test, ret = secret_service_unlock_dbus_paths_sync (test->service, paths, NULL, &unlocked, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); - g_assert (unlocked != NULL); + g_assert_nonnull (unlocked); g_assert_cmpstr (unlocked[0], ==, collection_path); - g_assert (unlocked[1] == NULL); + g_assert_null (unlocked[1]); g_strfreev (unlocked); } @@ -533,8 +533,8 @@ test_collection_sync (Test *test, g_hash_table_unref (properties); g_assert_no_error (error); - g_assert (path != NULL); - g_assert (g_str_has_prefix (path, "/org/freedesktop/secrets/collection/")); + g_assert_nonnull (path); + g_assert_true (g_str_has_prefix (path, "/org/freedesktop/secrets/collection/")); g_free (path); } @@ -558,7 +558,7 @@ test_collection_async (Test *test, NULL, on_complete_get_result, &result); g_hash_table_unref (properties); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -566,8 +566,8 @@ test_collection_async (Test *test, g_object_unref (result); g_assert_no_error (error); - g_assert (path != NULL); - g_assert (g_str_has_prefix (path, "/org/freedesktop/secrets/collection/")); + g_assert_nonnull (path); + g_assert_true (g_str_has_prefix (path, "/org/freedesktop/secrets/collection/")); g_free (path); } @@ -607,8 +607,8 @@ test_item_sync (Test *test, g_hash_table_unref (properties); g_assert_no_error (error); - g_assert (path != NULL); - g_assert (g_str_has_prefix (path, collection_path)); + g_assert_nonnull (path); + g_assert_true (g_str_has_prefix (path, collection_path)); g_free (path); } @@ -645,7 +645,7 @@ test_item_async (Test *test, properties, value, SECRET_ITEM_CREATE_NONE, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); secret_value_unref (value); g_hash_table_unref (properties); @@ -655,8 +655,8 @@ test_item_async (Test *test, g_object_unref (result); g_assert_no_error (error); - g_assert (path != NULL); - g_assert (g_str_has_prefix (path, collection_path)); + g_assert_nonnull (path); + g_assert_true (g_str_has_prefix (path, collection_path)); g_free (path); } @@ -671,11 +671,11 @@ test_set_alias_path (Test *test, path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); - g_assert (path == NULL); + g_assert_null (path); ret = secret_service_set_alias_to_dbus_path_sync (test->service, "blah", "/org/freedesktop/secrets/collection/english", NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); @@ -684,11 +684,11 @@ test_set_alias_path (Test *test, ret = secret_service_set_alias_to_dbus_path_sync (test->service, "blah", NULL, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error); g_assert_no_error (error); - g_assert (path == NULL); + g_assert_null (path); } static void @@ -706,12 +706,12 @@ test_encode_decode_secret (Test *test, g_assert_no_error (error); variant = secret_service_encode_dbus_secret (test->service, value); - g_assert (variant != NULL); + g_assert_nonnull (variant); g_assert_cmpstr (g_variant_get_type_string (variant), ==, "(oayays)"); secret_value_unref (value); decoded = secret_service_decode_dbus_secret (test->service, variant); - g_assert (variant != NULL); + g_assert_nonnull (variant); g_variant_unref (variant); g_assert_cmpstr (secret_value_get_text (decoded), ==, "zerogjuggs"); diff --git a/libsecret/test-prompt.c b/libsecret/test-prompt.c index a807531..54368fa 100644 --- a/libsecret/test-prompt.c +++ b/libsecret/test-prompt.c @@ -54,7 +54,7 @@ teardown (Test *test, { g_object_unref (test->service); secret_service_disconnect (); - g_assert (test->service == NULL); + g_assert_null (test->service); mock_service_stop (); } @@ -65,8 +65,8 @@ on_async_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -96,7 +96,7 @@ test_perform_sync (Test *test, retval = secret_prompt_perform_sync (prompt, NULL, NULL, NULL, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_variant_unref (retval); g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt); @@ -104,7 +104,7 @@ test_perform_sync (Test *test, g_source_remove (increment_id); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -124,7 +124,7 @@ test_perform_run (Test *test, retval = secret_prompt_run (prompt, 0, NULL, NULL, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_variant_unref (retval); g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt); @@ -135,7 +135,7 @@ test_perform_run (Test *test, egg_test_wait_idle (); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -151,13 +151,13 @@ test_perform_async (Test *test, g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt); secret_prompt_perform (prompt, 0, NULL, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); retval = secret_prompt_perform_finish (prompt, result, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_variant_unref (retval); g_object_unref (result); @@ -165,7 +165,7 @@ test_perform_async (Test *test, egg_test_wait_idle (); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -183,7 +183,7 @@ test_perform_cancel (Test *test, cancellable = g_cancellable_new (); secret_prompt_perform (prompt, 0, NULL, cancellable, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); g_cancellable_cancel (cancellable); g_object_unref (cancellable); @@ -192,7 +192,7 @@ test_perform_cancel (Test *test, retval = secret_prompt_perform_finish (prompt, result, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_variant_unref (retval); g_object_unref (result); @@ -201,7 +201,7 @@ test_perform_cancel (Test *test, /* Due to GDBus threading races */ egg_test_wait_until (100); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -217,11 +217,11 @@ test_perform_fail (Test *test, retval = secret_prompt_perform_sync (prompt, NULL, NULL, NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED); - g_assert (retval == NULL); + g_assert_null (retval); g_clear_error (&error); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -237,10 +237,10 @@ test_perform_vanish (Test *test, retval = secret_prompt_perform_sync (prompt, NULL, NULL, NULL, &error); g_assert_no_error (error); - g_assert (retval == NULL); + g_assert_null (retval); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -256,12 +256,12 @@ test_prompt_result (Test *test, retval = secret_prompt_perform_sync (prompt, 0, NULL, G_VARIANT_TYPE_STRING, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_assert_cmpstr (g_variant_get_string (retval, NULL), ==, "Special Result"); g_variant_unref (retval); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -277,12 +277,12 @@ test_prompt_window_id (Test *test, retval = secret_prompt_perform_sync (prompt, "555", NULL, G_VARIANT_TYPE_STRING, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_assert_cmpstr (g_variant_get_string (retval, NULL), ==, "555"); g_variant_unref (retval); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -298,11 +298,11 @@ test_service_sync (Test *test, retval = secret_service_prompt_sync (test->service, prompt, NULL, NULL, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_variant_unref (retval); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -318,13 +318,13 @@ test_service_async (Test *test, g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt); secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); retval = secret_service_prompt_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_variant_unref (retval); g_object_unref (result); @@ -332,7 +332,7 @@ test_service_async (Test *test, egg_test_wait_idle (); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -348,13 +348,13 @@ test_service_fail (Test *test, g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt); secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); retval = secret_service_prompt_finish (test->service, result, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED); - g_assert (retval == NULL); + g_assert_null (retval); g_object_unref (result); g_clear_error (&error); @@ -362,7 +362,7 @@ test_service_fail (Test *test, egg_test_wait_idle (); g_object_unref (prompt); - g_assert (prompt == NULL); + g_assert_null (prompt); } static void @@ -377,14 +377,14 @@ test_service_path (Test *test, prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple"); secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result); - g_assert (result == NULL); + g_assert_null (result); g_object_unref (prompt); egg_test_wait (); retval = secret_service_prompt_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (retval != NULL); + g_assert_nonnull (retval); g_variant_unref (retval); g_object_unref (result); diff --git a/libsecret/test-service.c b/libsecret/test-service.c index 96cfd2f..4759830 100644 --- a/libsecret/test-service.c +++ b/libsecret/test-service.c @@ -66,8 +66,8 @@ on_complete_get_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -90,19 +90,19 @@ test_get_sync (Test *test, g_assert_no_error (error); g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2); - g_assert (SECRET_IS_SERVICE (service1)); - g_assert (service1 == service2); + g_assert_true (SECRET_IS_SERVICE (service1)); + g_assert_true (service1 == service2); g_object_unref (service1); - g_assert (G_IS_OBJECT (service1)); + g_assert_true (G_IS_OBJECT (service1)); g_object_unref (service2); secret_service_disconnect (); - g_assert (service2 == NULL); + g_assert_null (service2); /* Services were disconnected, so this should create a new one */ service3 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error); - g_assert (SECRET_IS_SERVICE (service3)); + g_assert_true (SECRET_IS_SERVICE (service3)); g_assert_no_error (error); g_object_add_weak_pointer (G_OBJECT (service3), (gpointer *)&service3); @@ -112,7 +112,7 @@ test_get_sync (Test *test, g_usleep (G_USEC_PER_SEC); secret_service_disconnect (); - g_assert (service3 == NULL); + g_assert_null (service3); } static void @@ -128,33 +128,33 @@ test_get_async (Test *test, /* Both these sohuld point to the same thing */ secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); service1 = secret_service_get_finish (result, &error); g_assert_no_error (error); g_clear_object (&result); secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); service2 = secret_service_get_finish (result, &error); g_assert_no_error (error); g_clear_object (&result); g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2); - g_assert (SECRET_IS_SERVICE (service1)); - g_assert (service1 == service2); + g_assert_true (SECRET_IS_SERVICE (service1)); + g_assert_true (service1 == service2); g_object_unref (service1); - g_assert (G_IS_OBJECT (service1)); + g_assert_true (G_IS_OBJECT (service1)); g_object_unref (service2); secret_service_disconnect (); - g_assert (service2 == NULL); + g_assert_null (service2); /* Services were unreffed, so this should create a new one */ secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); service3 = secret_service_get_finish (result, &error); g_assert_no_error (error); @@ -163,7 +163,7 @@ test_get_async (Test *test, g_object_unref (service3); secret_service_disconnect (); - g_assert (service3 == NULL); + g_assert_null (service3); } static void @@ -185,12 +185,12 @@ test_get_more_sync (Test *test, service2 = secret_service_get_sync (SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error); g_assert_no_error (error); - g_assert (SECRET_IS_SERVICE (service)); - g_assert (service == service2); + g_assert_true (SECRET_IS_SERVICE (service)); + g_assert_true (service == service2); g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS); collections = secret_service_get_collections (service); - g_assert (collections != NULL); + g_assert_nonnull (collections); g_list_free_full (collections, g_object_unref); g_object_unref (service2); @@ -200,13 +200,13 @@ test_get_more_sync (Test *test, g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); path = secret_service_get_session_dbus_path (service); - g_assert (path != NULL); + g_assert_nonnull (path); g_object_unref (service2); g_object_unref (service); secret_service_disconnect (); - g_assert (service == NULL); + g_assert_null (service); } static void @@ -220,7 +220,7 @@ test_get_more_async (Test *test, GList *collections; secret_service_get (SECRET_SERVICE_LOAD_COLLECTIONS | SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -232,20 +232,20 @@ test_get_more_async (Test *test, g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); path = secret_service_get_session_dbus_path (service); - g_assert (path != NULL); + g_assert_nonnull (path); collections = secret_service_get_collections (service); - g_assert (collections != NULL); + g_assert_nonnull (collections); g_list_free_full (collections, g_object_unref); g_object_unref (service); secret_service_disconnect (); - g_assert (service == NULL); + g_assert_null (service); /* Now get a session with just collections */ secret_service_get (SECRET_SERVICE_LOAD_COLLECTIONS, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -256,15 +256,15 @@ test_get_more_async (Test *test, g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS); path = secret_service_get_session_dbus_path (service); - g_assert (path == NULL); + g_assert_null (path); collections = secret_service_get_collections (service); - g_assert (collections != NULL); + g_assert_nonnull (collections); g_list_free_full (collections, g_object_unref); g_object_unref (service); secret_service_disconnect (); - g_assert (service == NULL); + g_assert_null (service); } static void @@ -287,15 +287,15 @@ test_open_sync (Test *test, g_assert_no_error (error); g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2); - g_assert (SECRET_IS_SERVICE (service1)); - g_assert (SECRET_IS_SERVICE (service2)); - g_assert (service1 != service2); + g_assert_true (SECRET_IS_SERVICE (service1)); + g_assert_true (SECRET_IS_SERVICE (service2)); + g_assert_true (service1 != service2); g_object_unref (service1); - g_assert (service1 == NULL); + g_assert_null (service1); g_object_unref (service2); - g_assert (service2 == NULL); + g_assert_null (service2); } static void @@ -311,7 +311,7 @@ test_open_async (Test *test, secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); service1 = secret_service_open_finish (result, &error); g_assert_no_error (error); @@ -320,22 +320,22 @@ test_open_async (Test *test, secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); service2 = secret_service_open_finish (result, &error); g_assert_no_error (error); g_clear_object (&result); g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2); - g_assert (SECRET_IS_SERVICE (service1)); - g_assert (SECRET_IS_SERVICE (service2)); - g_assert (service1 != service2); + g_assert_true (SECRET_IS_SERVICE (service1)); + g_assert_true (SECRET_IS_SERVICE (service2)); + g_assert_true (service1 != service2); g_object_unref (service1); - g_assert (service1 == NULL); + g_assert_null (service1); g_object_unref (service2); - g_assert (service2 == NULL); + g_assert_null (service2); } static void @@ -350,44 +350,44 @@ test_open_more_sync (Test *test, service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL, &error); g_assert_no_error (error); - g_assert (SECRET_IS_SERVICE (service)); + g_assert_true (SECRET_IS_SERVICE (service)); g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service); g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_NONE); - g_assert (secret_service_get_collections (service) == NULL); - g_assert (secret_service_get_session_dbus_path (service) == NULL); + g_assert_null (secret_service_get_collections (service)); + g_assert_null (secret_service_get_session_dbus_path (service)); g_object_unref (service); - g_assert (service == NULL); + g_assert_null (service); service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error); g_assert_no_error (error); - g_assert (SECRET_IS_SERVICE (service)); + g_assert_true (SECRET_IS_SERVICE (service)); g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service); g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS); collections = secret_service_get_collections (service); - g_assert (collections != NULL); + g_assert_nonnull (collections); g_list_free_full (collections, g_object_unref); - g_assert (secret_service_get_session_dbus_path (service) == NULL); + g_assert_null (secret_service_get_session_dbus_path (service)); g_object_unref (service); - g_assert (service == NULL); + g_assert_null (service); service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_OPEN_SESSION, NULL, &error); g_assert_no_error (error); - g_assert (SECRET_IS_SERVICE (service)); + g_assert_true (SECRET_IS_SERVICE (service)); g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service); g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION); - g_assert (secret_service_get_collections (service) == NULL); + g_assert_null (secret_service_get_collections (service)); path = secret_service_get_session_dbus_path (service); - g_assert (path != NULL); + g_assert_nonnull (path); g_object_unref (service); - g_assert (service == NULL); + g_assert_null (service); } static void @@ -402,7 +402,7 @@ test_open_more_async (Test *test, secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_LOAD_COLLECTIONS | SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -414,20 +414,20 @@ test_open_more_async (Test *test, g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); path = secret_service_get_session_dbus_path (service); - g_assert (path != NULL); + g_assert_nonnull (path); collections = secret_service_get_collections (service); - g_assert (collections != NULL); + g_assert_nonnull (collections); g_list_free_full (collections, g_object_unref); g_object_unref (service); - g_assert (service == NULL); + g_assert_null (service); /* Now get a session with just collections */ secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_LOAD_COLLECTIONS, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); @@ -438,14 +438,14 @@ test_open_more_async (Test *test, g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS); path = secret_service_get_session_dbus_path (service); - g_assert (path == NULL); + g_assert_null (path); collections = secret_service_get_collections (service); - g_assert (collections != NULL); + g_assert_nonnull (collections); g_list_free_full (collections, g_object_unref); g_object_unref (service); - g_assert (service == NULL); + g_assert_null (service); } static void @@ -459,22 +459,22 @@ test_connect_async (Test *test, /* Passing false, not session */ secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); service = secret_service_get_finish (result, &error); - g_assert (SECRET_IS_SERVICE (service)); + g_assert_true (SECRET_IS_SERVICE (service)); g_assert_no_error (error); g_object_unref (result); g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service); path = secret_service_get_session_dbus_path (service); - g_assert (path == NULL); + g_assert_null (path); g_object_unref (service); secret_service_disconnect (); - g_assert (service == NULL); + g_assert_null (service); } static void @@ -488,22 +488,22 @@ test_connect_ensure_async (Test *test, /* Passing true, ensures session is established */ secret_service_get (SECRET_SERVICE_OPEN_SESSION, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); service = secret_service_get_finish (result, &error); g_assert_no_error (error); - g_assert (SECRET_IS_SERVICE (service)); + g_assert_true (SECRET_IS_SERVICE (service)); g_object_unref (result); g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service); path = secret_service_get_session_dbus_path (service); - g_assert (path != NULL); + g_assert_nonnull (path); g_object_unref (service); secret_service_disconnect (); - g_assert (service == NULL); + g_assert_null (service); } static void @@ -519,7 +519,7 @@ test_ensure_sync (Test *test, service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL, &error); g_assert_no_error (error); - g_assert (service != NULL); + g_assert_nonnull (service); g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service); flags = secret_service_get_flags (service); @@ -527,20 +527,20 @@ test_ensure_sync (Test *test, ret = secret_service_load_collections_sync (service, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_get (service, "flags", &flags, NULL); g_assert_cmpuint (flags, ==, SECRET_SERVICE_LOAD_COLLECTIONS); ret = secret_service_ensure_session_sync (service, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); flags = secret_service_get_flags (service); g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); g_object_unref (service); - g_assert (service == NULL); + g_assert_null (service); } static void @@ -557,19 +557,19 @@ test_ensure_async (Test *test, service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL, &error); g_assert_no_error (error); - g_assert (service != NULL); + g_assert_nonnull (service); flags = secret_service_get_flags (service); g_assert_cmpuint (flags, ==, SECRET_SERVICE_NONE); secret_service_load_collections (service, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_service_load_collections_finish (service, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); result = NULL; @@ -577,13 +577,13 @@ test_ensure_async (Test *test, g_assert_cmpuint (flags, ==, SECRET_SERVICE_LOAD_COLLECTIONS); secret_service_ensure_session (service, NULL, on_complete_get_result, &result); - g_assert (result == NULL); + g_assert_null (result); egg_test_wait (); ret = secret_service_ensure_session_finish (service, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_object_unref (result); result = NULL; g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service); @@ -592,7 +592,7 @@ test_ensure_async (Test *test, g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS); g_object_unref (service); - g_assert (service == NULL); + g_assert_null (service); } int diff --git a/libsecret/test-session.c b/libsecret/test-session.c index 3523f2a..f82db74 100644 --- a/libsecret/test-session.c +++ b/libsecret/test-session.c @@ -52,7 +52,7 @@ teardown (Test *test, { g_object_unref (test->service); secret_service_disconnect (); - g_assert (test->service == NULL); + g_assert_null (test->service); mock_service_stop (); } @@ -69,7 +69,7 @@ test_ensure (Test *test, ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); } @@ -87,14 +87,14 @@ test_ensure_twice (Test *test, ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); path = g_strdup (secret_service_get_session_dbus_path (test->service)); ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, path); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); @@ -114,7 +114,7 @@ test_ensure_plain (Test *test, ret = secret_service_ensure_session_sync (test->service, NULL, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); } @@ -125,8 +125,8 @@ on_complete_get_result (GObject *source, gpointer user_data) { GAsyncResult **ret = user_data; - g_assert (ret != NULL); - g_assert (*ret == NULL); + g_assert_nonnull (ret); + g_assert_null (*ret); *ret = g_object_ref (result); egg_test_wait_stop (); } @@ -142,11 +142,11 @@ test_ensure_async_plain (Test *test, secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result); egg_test_wait (); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); @@ -164,11 +164,11 @@ test_ensure_async_aes (Test *test, secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result); egg_test_wait_until (500); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "dh-ietf1024-sha256-aes128-cbc-pkcs7"); @@ -187,11 +187,11 @@ test_ensure_async_twice (Test *test, secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result); egg_test_wait_until (500); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), !=, NULL); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); @@ -202,11 +202,11 @@ test_ensure_async_twice (Test *test, secret_service_ensure_session (test->service, NULL, on_complete_get_result, &result); egg_test_wait_until (500); - g_assert (G_IS_ASYNC_RESULT (result)); + g_assert_true (G_IS_ASYNC_RESULT (result)); ret = secret_service_ensure_session_finish (test->service, result, &error); g_assert_no_error (error); - g_assert (ret == TRUE); + g_assert_true (ret); g_assert_cmpstr (secret_service_get_session_dbus_path (test->service), ==, path); g_assert_cmpstr (secret_service_get_session_algorithms (test->service), ==, "plain"); diff --git a/libsecret/test-value.c b/libsecret/test-value.c index 9e1903b..c4a538e 100644 --- a/libsecret/test-value.c +++ b/libsecret/test-value.c @@ -71,7 +71,7 @@ test_new_full (void) g_assert_cmpuint (length, ==, 4); /* No copy done here */ - g_assert (secret_value_get (value, NULL) == data); + g_assert_true (secret_value_get (value, NULL) == data); secret_value_unref (value); } @@ -89,7 +89,7 @@ test_new_full_terminated (void) g_assert_cmpuint (length, ==, 4); /* No copy done here */ - g_assert (secret_value_get (value, NULL) == data); + g_assert_true (secret_value_get (value, NULL) == data); secret_value_unref (value); } @@ -102,14 +102,14 @@ test_new_empty (void) gsize length; value = secret_value_new (NULL, 0, "text/plain"); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 0); g_assert_cmpstr (password, ==, ""); secret_value_unref (value); value = secret_value_new ("", 0, "text/plain"); - g_assert (value != NULL); + g_assert_nonnull (value); password = secret_value_get (value, &length); g_assert_cmpuint (length, ==, 0); g_assert_cmpstr (password, ==, "");