summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAbanoub Ghadban <abanoub.gdb@gmail.com>2021-07-19 16:13:13 +0200
committerCarlos Garnacho <carlosg@gnome.org>2021-10-05 15:26:12 +0200
commit20365c043cee5efb8ca211ac308310b68716d9ef (patch)
tree63387131285bc072f0ba3a741a25b6ea4df131a0 /tests
parentf909916a7f1e9cc8481195f86725af82954b7049 (diff)
downloadtracker-20365c043cee5efb8ca211ac308310b68716d9ef.tar.gz
make ontology-error test use regular expressions instead of strcmp
Diffstat (limited to 'tests')
-rw-r--r--tests/libtracker-data/tracker-ontology-error-test.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/libtracker-data/tracker-ontology-error-test.c b/tests/libtracker-data/tracker-ontology-error-test.c
index 0a147ed90..e8e9fea25 100644
--- a/tests/libtracker-data/tracker-ontology-error-test.c
+++ b/tests/libtracker-data/tracker-ontology-error-test.c
@@ -49,6 +49,8 @@ ontology_error_helper (GFile *ontology_location, char *error_path)
gchar *error_msg = NULL;
GError* error = NULL;
GError* ontology_error = NULL;
+ GMatchInfo *matchInfo;
+ GRegex *regex;
manager = tracker_data_manager_new (TRACKER_DB_MANAGER_IN_MEMORY,
NULL, ontology_location,
@@ -58,8 +60,16 @@ ontology_error_helper (GFile *ontology_location, char *error_path)
g_file_get_contents (error_path, &error_msg, NULL, &error);
g_assert_no_error (error);
- g_assert_cmpstr (ontology_error->message, ==, error_msg);
+ regex = g_regex_new (error_msg, 0, 0, &error);
+ g_regex_match (regex, ontology_error->message, 0, &matchInfo);
+
+ if (!g_match_info_matches (matchInfo))
+ g_error ("Error Message: %s doesn't match the regular expression: %s",
+ ontology_error->message, error_msg);
+
+ g_regex_unref (regex);
+ g_match_info_unref (matchInfo);
g_error_free (ontology_error);
g_free (error_msg);
g_object_unref (manager);