summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2020-05-02 16:44:44 +0200
committerSam Thursfield <sam@afuera.me.uk>2020-09-02 12:17:31 +0200
commit1321a34947075801bbde7a7cae446c3f6af027f0 (patch)
treed816fbf7e670e13dea75c561ddf1fbfb200884e6 /test
parent452c25e33ac45aa44926b0663b6f0601a4654512 (diff)
downloadnautilus-1321a34947075801bbde7a7cae446c3f6af027f0.tar.gz
tests: Make search tests return error codes on failure
Previously the tests could appear to succeed even if the search didn't work as expected.
Diffstat (limited to 'test')
-rw-r--r--test/automated/displayless/test-nautilus-search-engine-model.c7
-rw-r--r--test/automated/displayless/test-nautilus-search-engine-simple.c6
-rw-r--r--test/automated/displayless/test-nautilus-search-engine-tracker.c6
-rw-r--r--test/automated/displayless/test-nautilus-search-engine.c6
4 files changed, 25 insertions, 0 deletions
diff --git a/test/automated/displayless/test-nautilus-search-engine-model.c b/test/automated/displayless/test-nautilus-search-engine-model.c
index af1a9b4bb..0a68bd797 100644
--- a/test/automated/displayless/test-nautilus-search-engine-model.c
+++ b/test/automated/displayless/test-nautilus-search-engine-model.c
@@ -1,5 +1,7 @@
#include "test-utilities.h"
+static guint total_hits = 0;
+
static void
hits_added_cb (NautilusSearchEngine *engine,
GSList *hits)
@@ -8,6 +10,8 @@ hits_added_cb (NautilusSearchEngine *engine,
for (gint hit_number = 0; hits != NULL; hits = hits->next, hit_number++)
{
g_print ("Hit %i: %s\n", hit_number, nautilus_search_hit_get_uri (hits->data));
+
+ total_hits += 1;
}
}
@@ -68,5 +72,8 @@ main (int argc,
NAUTILUS_SEARCH_ENGINE_MODEL_ENGINE);
g_main_loop_run (loop);
+
+ g_assert_cmpint (total_hits, ==, 3);
+
return 0;
}
diff --git a/test/automated/displayless/test-nautilus-search-engine-simple.c b/test/automated/displayless/test-nautilus-search-engine-simple.c
index 728c7ce32..9657bb622 100644
--- a/test/automated/displayless/test-nautilus-search-engine-simple.c
+++ b/test/automated/displayless/test-nautilus-search-engine-simple.c
@@ -1,5 +1,7 @@
#include "test-utilities.h"
+static guint total_hits = 0;
+
static void
hits_added_cb (NautilusSearchEngine *engine,
GSList *hits)
@@ -8,6 +10,7 @@ hits_added_cb (NautilusSearchEngine *engine,
for (gint hit_number = 0; hits != NULL; hits = hits->next, hit_number++)
{
g_print ("Hit %i: %s\n", hit_number, nautilus_search_hit_get_uri (hits->data));
+ total_hits += 1;
}
}
@@ -64,5 +67,8 @@ main (int argc,
NAUTILUS_SEARCH_ENGINE_SIMPLE_ENGINE);
g_main_loop_run (loop);
+
+ g_assert_cmpint (total_hits, ==, 3);
+
return 0;
}
diff --git a/test/automated/displayless/test-nautilus-search-engine-tracker.c b/test/automated/displayless/test-nautilus-search-engine-tracker.c
index 0de2d404b..fdbca124f 100644
--- a/test/automated/displayless/test-nautilus-search-engine-tracker.c
+++ b/test/automated/displayless/test-nautilus-search-engine-tracker.c
@@ -1,5 +1,7 @@
#include "test-utilities.h"
+static guint total_hits = 0;
+
static void
hits_added_cb (NautilusSearchEngine *engine,
GSList *hits)
@@ -8,6 +10,7 @@ hits_added_cb (NautilusSearchEngine *engine,
for (gint hit_number = 0; hits != NULL; hits = hits->next, hit_number++)
{
g_print ("Hit %i: %s\n", hit_number, nautilus_search_hit_get_uri (hits->data));
+ total_hits += 1;
}
}
@@ -102,5 +105,8 @@ main (int argc,
NAUTILUS_SEARCH_ENGINE_TRACKER_ENGINE);
g_main_loop_run (loop);
+
+ g_assert_cmpint (total_hits, ==, 1);
+
return 0;
}
diff --git a/test/automated/displayless/test-nautilus-search-engine.c b/test/automated/displayless/test-nautilus-search-engine.c
index 28c02efb0..cc843de6e 100644
--- a/test/automated/displayless/test-nautilus-search-engine.c
+++ b/test/automated/displayless/test-nautilus-search-engine.c
@@ -1,5 +1,7 @@
#include "test-utilities.h"
+static guint total_hits = 0;
+
static void
hits_added_cb (NautilusSearchEngine *engine,
GSList *hits)
@@ -8,6 +10,7 @@ hits_added_cb (NautilusSearchEngine *engine,
for (gint hit_number = 0; hits != NULL; hits = hits->next, hit_number++)
{
g_print ("Hit %i: %s\n", hit_number, nautilus_search_hit_get_uri (hits->data));
+ total_hits += 1;
}
}
@@ -64,5 +67,8 @@ main (int argc,
nautilus_search_provider_start (NAUTILUS_SEARCH_PROVIDER (engine));
g_main_loop_run (loop);
+
+ g_assert_cmpint (total_hits, ==, 3);
+
return 0;
}