summaryrefslogtreecommitdiff
path: root/tests/libtracker-sparql
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2020-08-12 23:15:45 +0200
committerSam Thursfield <sam@afuera.me.uk>2020-08-12 23:15:45 +0200
commitbbf5b19f9862b4bd78f41a49308976ff84769acc (patch)
tree8d1711caf9a4eae75160246c9a2fe63915316e60 /tests/libtracker-sparql
parentdfe542d94fa7190a4965561cd460685fba6196b2 (diff)
downloadtracker-bbf5b19f9862b4bd78f41a49308976ff84769acc.tar.gz
tests: Use g_assert_true() instead of g_assert()
This fixes the tests when -DG_DISABLE_ASSERT is passed at compile time. See https://gitlab.gnome.org/GNOME/tracker/-/issues/240
Diffstat (limited to 'tests/libtracker-sparql')
-rw-r--r--tests/libtracker-sparql/tracker-fd-test.c50
-rw-r--r--tests/libtracker-sparql/tracker-resource-test.c18
-rw-r--r--tests/libtracker-sparql/tracker-sparql-test.c12
3 files changed, 40 insertions, 40 deletions
diff --git a/tests/libtracker-sparql/tracker-fd-test.c b/tests/libtracker-sparql/tracker-fd-test.c
index 7e801418e..d65e1651a 100644
--- a/tests/libtracker-sparql/tracker-fd-test.c
+++ b/tests/libtracker-sparql/tracker-fd-test.c
@@ -180,8 +180,8 @@ query_and_compare_results (const char *query)
}
/* Check that both cursors are at the end (same number of rows) */
- g_assert (!tracker_sparql_cursor_next (cursor_glib, NULL, NULL));
- g_assert (!tracker_sparql_cursor_next (cursor_fd, NULL, NULL));
+ g_assert_true (!tracker_sparql_cursor_next (cursor_glib, NULL, NULL));
+ g_assert_true (!tracker_sparql_cursor_next (cursor_fd, NULL, NULL));
g_object_unref (cursor_glib);
g_object_unref (cursor_fd);
@@ -213,7 +213,7 @@ test_tracker_sparql_query_iterate_error (DataFixture *fixture,
cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
/* tracker_sparql_query_iterate should return null on error */
- g_assert (!cursor);
+ g_assert_true (!cursor);
/* error should be set, along with its message, note: we don't
* use g_assert_error() because the code does not match the
@@ -221,7 +221,7 @@ test_tracker_sparql_query_iterate_error (DataFixture *fixture,
* dbus/error matching between client/server. This should be
* fixed in gdbus.
*/
- g_assert (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
+ g_assert_true (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
g_error_free (error);
}
@@ -237,7 +237,7 @@ test_tracker_sparql_query_iterate_empty_subprocess (DataFixture *fixture,
cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
- g_assert (tracker_sparql_cursor_next (cursor, NULL, NULL));
+ g_assert_true (tracker_sparql_cursor_next (cursor, NULL, NULL));
/* Testing we fail with this error:
*
@@ -258,13 +258,13 @@ test_tracker_sparql_query_iterate_empty (DataFixture *fixture,
cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
- g_assert (cursor);
+ g_assert_true (cursor);
g_assert_no_error (error);
- g_assert (!tracker_sparql_cursor_next (cursor, NULL, NULL));
+ g_assert_true (!tracker_sparql_cursor_next (cursor, NULL, NULL));
/* This should be 1, the original test had it wrong: there's one column,
* no matter if there are no results*/
- g_assert (tracker_sparql_cursor_get_n_columns (cursor) == 1);
+ g_assert_true (tracker_sparql_cursor_get_n_columns (cursor) == 1);
g_test_trap_subprocess ("/steroids/tracker/tracker_sparql_query_iterate_empty/subprocess", 0, 0);
g_test_trap_assert_failed ();
@@ -283,10 +283,10 @@ test_tracker_sparql_query_iterate_sigpipe (DataFixture *fixture,
cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
- g_assert (cursor);
+ g_assert_true (cursor);
g_assert_no_error (error);
- g_assert (tracker_sparql_cursor_next (cursor, NULL, NULL));
+ g_assert_true (tracker_sparql_cursor_next (cursor, NULL, NULL));
g_object_unref (cursor);
}
@@ -336,7 +336,7 @@ async_update_array_callback (GObject *source_object,
tracker_sparql_connection_update_array_finish (connection, result, &error);
/* main error is only set on fatal (D-Bus) errors that apply to the whole update */
- g_assert (error != NULL);
+ g_assert_true (error != NULL);
g_main_loop_quit (data->main_loop);
}
@@ -385,7 +385,7 @@ test_tracker_sparql_update_fast_error (DataFixture *fixture,
tracker_sparql_connection_update (connection, query, NULL, &error);
- g_assert (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
+ g_assert_true (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
g_error_free (error);
}
@@ -400,7 +400,7 @@ test_tracker_sparql_update_blank_fast_small (DataFixture *fixture,
results = tracker_sparql_connection_update_blank (connection, query, NULL, &error);
g_assert_no_error (error);
- g_assert (results);
+ g_assert_true (results);
/* FIXME: Properly test once we get update_blank implemented */
}
@@ -426,7 +426,7 @@ test_tracker_sparql_update_blank_fast_large (DataFixture *fixture,
g_free (query);
g_assert_no_error (error);
- g_assert (results);
+ g_assert_true (results);
/* FIXME: Properly test once we get update_blank implemented */
}
@@ -441,8 +441,8 @@ test_tracker_sparql_update_blank_fast_error (DataFixture *fixture,
results = tracker_sparql_connection_update_blank (connection, query, NULL, &error);
- g_assert (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
- g_assert (!results);
+ g_assert_true (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
+ g_assert_true (!results);
g_error_free (error);
}
@@ -460,7 +460,7 @@ test_tracker_sparql_update_blank_fast_no_blanks (DataFixture *fixture,
/* FIXME: Properly test once we get update_blank implemented */
g_assert_no_error (error);
- g_assert (results);
+ g_assert_true (results);
}
static void
@@ -473,7 +473,7 @@ test_tracker_batch_sparql_update_fast (DataFixture *fixture,
/* FIXME: batch update is missing so far
* tracker_sparql_connection_batch_update (connection, query, NULL, &error); */
- /* g_assert (!error); */
+ /* g_assert_true (!error); */
}
static void
@@ -491,12 +491,12 @@ async_query_cb (GObject *source_object,
cursor_fd = tracker_sparql_connection_query_finish (connection, result, &error);
g_assert_no_error (error);
- g_assert (cursor_fd != NULL);
+ g_assert_true (cursor_fd != NULL);
cursor_glib = tracker_sparql_connection_query (connection, data->query, NULL, &error);
g_assert_no_error (error);
- g_assert (cursor_glib != NULL);
+ g_assert_true (cursor_glib != NULL);
while (tracker_sparql_cursor_next (cursor_fd, NULL, NULL) &&
tracker_sparql_cursor_next (cursor_glib, NULL, NULL)) {
@@ -505,8 +505,8 @@ async_query_cb (GObject *source_object,
tracker_sparql_cursor_get_string (cursor_glib, 0, NULL));
}
- g_assert (!tracker_sparql_cursor_next (cursor_fd, NULL, NULL));
- g_assert (!tracker_sparql_cursor_next (cursor_glib, NULL, NULL));
+ g_assert_true (!tracker_sparql_cursor_next (cursor_fd, NULL, NULL));
+ g_assert_true (!tracker_sparql_cursor_next (cursor_glib, NULL, NULL));
g_object_unref (cursor_fd);
g_object_unref (cursor_glib);
@@ -551,7 +551,7 @@ cancel_query_cb (GObject *source_object,
tracker_sparql_connection_query_finish (connection, result, &error);
/* An error should be returned (cancelled!) */
- g_assert (error);
+ g_assert_true (error);
}
static void
@@ -630,7 +630,7 @@ cancel_update_cb (GObject *source_object,
tracker_sparql_connection_update_finish (connection, result, &error);
/* An error should be returned (cancelled!) */
- g_assert (error);
+ g_assert_true (error);
}
static void
@@ -669,7 +669,7 @@ async_update_blank_callback (GObject *source_object,
results = tracker_sparql_connection_update_blank_finish (connection, result, &error);
g_assert_no_error (error);
- g_assert (results != NULL);
+ g_assert_true (results != NULL);
}
static void
diff --git a/tests/libtracker-sparql/tracker-resource-test.c b/tests/libtracker-sparql/tracker-resource-test.c
index 0506c0771..068b1c2fc 100644
--- a/tests/libtracker-sparql/tracker-resource-test.c
+++ b/tests/libtracker-sparql/tracker-resource-test.c
@@ -30,13 +30,13 @@ test_resource_get_empty (void)
resource = tracker_resource_new ("http://example.com/resource");
- g_assert (tracker_resource_get_values (resource, "http://example.com/0") == NULL);
+ g_assert_true (tracker_resource_get_values (resource, "http://example.com/0") == NULL);
- g_assert (tracker_resource_get_first_double (resource, "http://example.com/0") == 0.0);
- g_assert (tracker_resource_get_first_int (resource, "http://example.com/0") == 0);
- g_assert (tracker_resource_get_first_int64 (resource, "http://example.com/0") == 0);
- g_assert (tracker_resource_get_first_string (resource, "http://example.com/0") == NULL);
- g_assert (tracker_resource_get_first_uri (resource, "http://example.com/0") == NULL);
+ g_assert_true (tracker_resource_get_first_double (resource, "http://example.com/0") == 0.0);
+ g_assert_true (tracker_resource_get_first_int (resource, "http://example.com/0") == 0);
+ g_assert_true (tracker_resource_get_first_int64 (resource, "http://example.com/0") == 0);
+ g_assert_true (tracker_resource_get_first_string (resource, "http://example.com/0") == NULL);
+ g_assert_true (tracker_resource_get_first_uri (resource, "http://example.com/0") == NULL);
g_object_unref (resource);
}
@@ -54,9 +54,9 @@ test_resource_get_set_simple (void)
tracker_resource_set_string (resource, "http://example.com/4", "Hello");
tracker_resource_set_uri (resource, "http://example.com/5", "http://example.com/");
- g_assert (tracker_resource_get_first_double (resource, "http://example.com/1") == 0.6);
+ g_assert_true (tracker_resource_get_first_double (resource, "http://example.com/1") == 0.6);
g_assert_cmpint (tracker_resource_get_first_int (resource, "http://example.com/2"), ==, 60);
- g_assert (tracker_resource_get_first_int64 (resource, "http://example.com/3") == 123456789);
+ g_assert_true (tracker_resource_get_first_int64 (resource, "http://example.com/3") == 123456789);
g_assert_cmpstr (tracker_resource_get_first_string (resource, "http://example.com/4"), ==, "Hello");
g_assert_cmpstr (tracker_resource_get_first_uri (resource, "http://example.com/5"), ==, "http://example.com/");
@@ -119,7 +119,7 @@ test_resource_get_set_many (void)
g_assert_cmpint (g_value_get_int (list->data), ==, 60);
g_assert_cmpstr (g_value_get_string (list->next->data), ==, "Hello");
- g_assert (G_VALUE_HOLDS (list->next->next->data, RANDOM_GVALUE_TYPE));
+ g_assert_true (G_VALUE_HOLDS (list->next->next->data, RANDOM_GVALUE_TYPE));
g_list_free_full (list, (GDestroyNotify) g_value_unset);
diff --git a/tests/libtracker-sparql/tracker-sparql-test.c b/tests/libtracker-sparql/tracker-sparql-test.c
index 0079cd18a..ec831cb12 100644
--- a/tests/libtracker-sparql/tracker-sparql-test.c
+++ b/tests/libtracker-sparql/tracker-sparql-test.c
@@ -119,7 +119,7 @@ test_tracker_sparql_cursor_next_async_cb (GObject *source,
query = GPOINTER_TO_INT(user_data);
- g_assert (result != NULL);
+ g_assert_true (result != NULL);
success = tracker_sparql_cursor_next_finish (TRACKER_SPARQL_CURSOR (source),
result,
&error);
@@ -132,7 +132,7 @@ test_tracker_sparql_cursor_next_async_cb (GObject *source,
}
cursor = TRACKER_SPARQL_CURSOR (source);
- g_assert (cursor != NULL);
+ g_assert_true (cursor != NULL);
connection = tracker_sparql_cursor_get_connection (cursor);
if (!success) {
@@ -173,18 +173,18 @@ test_tracker_sparql_cursor_next_async_query (TrackerSparqlConnection *connection
TrackerSparqlCursor *cursor;
GError *error = NULL;
- g_assert (query < G_N_ELEMENTS (queries));
+ g_assert_true (query < G_N_ELEMENTS (queries));
g_print ("ASYNC query %d starting:\n", query);
cancellables[query] = g_cancellable_new ();
- g_assert (cancellables[query] != NULL);
+ g_assert_true (cancellables[query] != NULL);
cursor = tracker_sparql_connection_query (connection,
queries[query],
NULL,
&error);
g_assert_no_error (error);
- g_assert (cursor != NULL);
+ g_assert_true (cursor != NULL);
tracker_sparql_cursor_next_async (cursor,
cancellables[query],
@@ -208,7 +208,7 @@ test_tracker_sparql_cursor_next_async (void)
connection = create_local_connection (&error);
g_assert_no_error (error);
- g_assert (connection != NULL);
+ g_assert_true (connection != NULL);
test_tracker_sparql_cursor_next_async_query (connection, 0);
g_main_loop_run (main_loop);