[glom] Fake connection test: Test for a substring in the generated query.



commit df63e5ff56eb5d20b1e61ca310acd9582c840551
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Nov 14 09:51:25 2011 +0100

    Fake connection test: Test for a substring in the generated query.
    
    * tests/test_fake_connection.cc: This also fixes the build with
    -Werror.

 ChangeLog                     |    7 +++++++
 tests/test_fake_connection.cc |    7 +++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index dbf2f0e..3c4081e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-14  Murray Cumming  <murrayc murrayc com>
+
+	Fake connection test: Test for a substring in the generated query.
+
+	* tests/test_fake_connection.cc: This also fixes the build with
+	-Werror.
+
 2011-11-13  Murray Cumming  <murrayc murrayc com>
 
 	Use the new Gnome::Gda::Numeric API.
diff --git a/tests/test_fake_connection.cc b/tests/test_fake_connection.cc
index 5ba2b47..9b55b79 100644
--- a/tests/test_fake_connection.cc
+++ b/tests/test_fake_connection.cc
@@ -90,6 +90,13 @@ int main()
     Glom::Utils::build_sql_select_with_where_clause("albums",
       fieldsToGet, where_clause);
   const Glib::ustring& query = Glom::Utils::sqlbuilder_get_full_query(builder);
+  g_assert(!query.empty());
+  if(query.find("album_id") == Glib::ustring::npos)
+  {
+    std::cerr << "Failed: The query did not contain an expected field name." << std::endl;
+    return EXIT_FAILURE;
+  }
+
   //std::cout << "query: " << query << std::endl;
 
   Glom::libglom_deinit();



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