[gom/wip/hadess/fix-constraints-test] tests: Fix constraints test under RHEL7



commit 743c0fd31646e247ef6eb591d49e3130218b1314
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 11 18:45:51 2020 +0100

    tests: Fix constraints test under RHEL7
    
    The error messages under sqlite-3.7.17-8.el7_7.1.x86_64 were slightly
    different, causing the tests to fail.

 tests/test-gom-constraints.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/tests/test-gom-constraints.c b/tests/test-gom-constraints.c
index 518ceb8..b421b24 100644
--- a/tests/test-gom-constraints.c
+++ b/tests/test-gom-constraints.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <string.h>
 #include <gom/gom.h>
 #include <glib/gstdio.h>
@@ -229,8 +230,8 @@ test_unique (void)
                        NULL);
   gom_resource_save_sync(GOM_RESOURCE(item), &error);
   g_assert_error(error, GOM_ERROR, GOM_ERROR_COMMAND_SQLITE);
-  g_assert (strstr (error->message, "UNIQUE") != NULL);
-  g_assert (strstr (error->message, "items.email") != NULL);
+  g_assert (strcasestr (error->message, "UNIQUE") != NULL);
+  g_assert (strstr (error->message, "email") != NULL);
   g_object_unref(item);
   g_clear_error(&error);
 
@@ -266,8 +267,8 @@ test_notnull (void)
                        NULL);
   gom_resource_save_sync(GOM_RESOURCE(item), &error);
   g_assert_error(error, GOM_ERROR, GOM_ERROR_COMMAND_SQLITE);
-  g_assert (strstr (error->message, "NOT NULL") != NULL);
-  g_assert (strstr (error->message, "items.name") != NULL);
+  g_assert (strstr (error->message, "NULL") != NULL);
+  g_assert (strstr (error->message, "name") != NULL);
   g_clear_error(&error);
   g_object_unref(item);
 
@@ -277,8 +278,8 @@ test_notnull (void)
                        NULL);
   gom_resource_save_sync(GOM_RESOURCE(item), &error);
   g_assert_error(error, GOM_ERROR, GOM_ERROR_COMMAND_SQLITE);
-  g_assert (strstr (error->message, "NOT NULL") != NULL);
-  g_assert (strstr (error->message, "items.email") != NULL);
+  g_assert (strstr (error->message, "NULL") != NULL);
+  g_assert (strstr (error->message, "email") != NULL);
   g_clear_error(&error);
   g_object_unref(item);
 


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