[tracker] tests: Tear down test data in tracker-steroids tests



commit ee7b32875388f612f7d2270fe9e10df0585f666b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat May 14 13:34:27 2016 +0200

    tests: Tear down test data in tracker-steroids tests

 tests/tracker-steroids/tracker-test.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/tests/tracker-steroids/tracker-test.c b/tests/tracker-steroids/tracker-test.c
index 8eada53..b5ed7d5 100644
--- a/tests/tracker-steroids/tracker-test.c
+++ b/tests/tracker-steroids/tracker-test.c
@@ -35,7 +35,7 @@ typedef struct {
 static TrackerSparqlConnection *connection;
 
 static void
-insert_test_data ()
+delete_test_data ()
 {
        GError *error = NULL;
        const char *delete_query = "DELETE { "
@@ -44,9 +44,21 @@ insert_test_data ()
                                   "<urn:testdata3> a rdfs:Resource ."
                                   "<urn:testdata4> a rdfs:Resource ."
                                   "}";
+
+       tracker_sparql_connection_update (connection, delete_query, 0, NULL, &error);
+       g_assert_no_error (error);
+}
+
+static void
+insert_test_data ()
+{
+       GError *error = NULL;
        char *longName = g_malloc (LONG_NAME_SIZE);
        char *filled_query;
 
+       /* Ensure data is deleted */
+       delete_test_data ();
+
        memset (longName, 'a', LONG_NAME_SIZE);
 
        longName[LONG_NAME_SIZE - 1] = '\0';
@@ -58,9 +70,6 @@ insert_test_data ()
                                        "    <urn:testdata4> a nmm:Photo ; nao:identifier \"%s\" ."
                                        "}", longName);
 
-       tracker_sparql_connection_update (connection, delete_query, 0, NULL, &error);
-       g_assert_no_error (error);
-
        tracker_sparql_connection_update (connection, filled_query, 0, NULL, &error);
        g_assert_no_error (error);
 
@@ -710,5 +719,7 @@ main (gint argc, gchar **argv)
        g_test_add_func ("/steroids/tracker/tracker_sparql_update_blank_async", 
test_tracker_sparql_update_blank_async);
        g_test_add_func ("/steroids/tracker/tracker_sparql_update_array_async", 
test_tracker_sparql_update_array_async);
 
+       delete_test_data ();
+
        return g_test_run ();
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]