[gom] tests: And check for assertion due to invalid table name



commit 7cb346a0e3f83bffa0bfba5b35ab5e8a27c0a9e2
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Aug 9 13:16:01 2017 +0200

    tests: And check for assertion due to invalid table name
    
    The old test would simply crash when attempting to use a
    resource with the invalid table name for the first time. With the
    validity checks, we now assert much earlier. Adapt the test to succeed
    if the check fails as expected.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785983

 tests/test-gom-table-name.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-gom-table-name.c b/tests/test-gom-table-name.c
index 7c099d0..d17f661 100644
--- a/tests/test-gom-table-name.c
+++ b/tests/test-gom-table-name.c
@@ -156,6 +156,14 @@ table_name (void)
    char *s1, *s2;
    ItemResource *it;
 
+   if (!g_test_subprocess ()) {
+      /* Rerun this same test in a subprocess */
+      g_test_trap_subprocess (NULL, 0, 0);
+      g_test_trap_assert_failed ();
+      g_test_trap_assert_stderr ("*CRITICAL*is_valid_table_name*failed*");
+      return;
+   }
+
    adapter = gom_adapter_new();
    //ret = gom_adapter_open_sync(adapter, "file:test.db", &error);
    ret = gom_adapter_open_sync(adapter, ":memory:", &error);


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