[glom] tests: Avoid some copy/pasting.



commit 0e9b9abca77b799613b543bd46fc88c3edf381eb
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jan 4 00:24:43 2013 +0100

    tests: Avoid some copy/pasting.
    
    * tests/test_selfhosting_utils.[h|cc]:
    Add test_all_hosting_modes().
            * tests/test_selfhosting_new_empty.cc:
            * tests/test_selfhosting_new_empty_change_sysprefs.cc:
            * tests/test_selfhosting_new_empty_then_users.cc:
            * tests/test_selfhosting_new_from_example.cc:
            * tests/test_selfhosting_new_from_example_operator.cc:
            * tests/test_selfhosting_new_from_example_strangepath.cc:
            * tests/test_selfhosting_new_then_alter_table.cc:
            * tests/test_selfhosting_new_then_change_columns.cc:
            * tests/test_selfhosting_new_then_choices.cc:
            * tests/test_selfhosting_new_then_image.cc:
            * tests/test_selfhosting_new_then_lookup.cc:
            * tests/test_selfhosting_new_then_report.cc:
            * tests/test_selfhosting_non_numeric_primary_keys.cc:
            * tests/test_selfhosting_sqlinjection.cc: Use this,
    passing a callback slot, instead of having the same repeated
    code in each file.

 ChangeLog                                          |   23 ++++++++++++++++++++
 tests/test_selfhosting_new_empty.cc                |    7 ------
 ...est_selfhosting_new_from_example_strangepath.cc |    7 ++++++
 tests/test_selfhosting_utils.cc                    |    7 ++++++
 4 files changed, 37 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 84a8908..14763a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,29 @@
 
 2013-01-03  Murray Cumming  <murrayc murrayc com>
 
+        tests: Avoid some copy/pasting.
+
+	* tests/test_selfhosting_utils.[h|cc]:
+	Add test_all_hosting_modes().
+        * tests/test_selfhosting_new_empty.cc:
+        * tests/test_selfhosting_new_empty_change_sysprefs.cc:
+        * tests/test_selfhosting_new_empty_then_users.cc:
+        * tests/test_selfhosting_new_from_example.cc:
+        * tests/test_selfhosting_new_from_example_operator.cc:
+        * tests/test_selfhosting_new_from_example_strangepath.cc:
+        * tests/test_selfhosting_new_then_alter_table.cc:
+        * tests/test_selfhosting_new_then_change_columns.cc:
+        * tests/test_selfhosting_new_then_choices.cc:
+        * tests/test_selfhosting_new_then_image.cc:
+        * tests/test_selfhosting_new_then_lookup.cc:
+        * tests/test_selfhosting_new_then_report.cc:
+        * tests/test_selfhosting_non_numeric_primary_keys.cc:
+        * tests/test_selfhosting_sqlinjection.cc: Use this,
+	passing a callback slot, instead of having the same repeated
+	code in each file.
+
+2013-01-03  Murray Cumming  <murrayc murrayc com>
+
         MySQL: Use the new PROTOCOL connection parameter with libgda.
 
         * glom/libglom/connectionpool_backends/mysql.cc: attempt_connect():
diff --git a/tests/test_selfhosting_new_empty.cc b/tests/test_selfhosting_new_empty.cc
index 4e727d4..7536da9 100644
--- a/tests/test_selfhosting_new_empty.cc
+++ b/tests/test_selfhosting_new_empty.cc
@@ -59,13 +59,6 @@ int main()
 
   const int result = test_all_hosting_modes(sigc::ptr_fun(&test));
 
-  if(!test(Glom::Document::HOSTING_MODE_MYSQL_SELF))
-  {
-    std::cerr << "Failed with MySQL" << std::endl;
-    test_selfhosting_cleanup();
-    return EXIT_FAILURE;
-  }
-
   Glom::libglom_deinit();
 
   return result;
diff --git a/tests/test_selfhosting_new_from_example_strangepath.cc b/tests/test_selfhosting_new_from_example_strangepath.cc
index e2f62ba..749e0bf 100644
--- a/tests/test_selfhosting_new_from_example_strangepath.cc
+++ b/tests/test_selfhosting_new_from_example_strangepath.cc
@@ -28,6 +28,13 @@
 
 static bool test(Glom::Document::HostingMode hosting_mode)
 {
+  //TODO: MySQL: See if we can get this to work.
+  if(hosting_mode == Glom::Document::HOSTING_MODE_MYSQL_SELF)
+  {
+    test_selfhosting_cleanup(false /* do not delete the file. */);
+    return true;
+  }
+
   Glom::Document document;
   const bool recreated = 
     test_create_and_selfhost_from_example("example_music_collection.glom", document, 
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index 6118d8e..1068d94 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -542,6 +542,13 @@ int test_all_hosting_modes(const SlotTest& slot)
     return EXIT_FAILURE;
   }
 
+  if(!slot(Glom::Document::HOSTING_MODE_MYSQL_SELF))
+  {
+    std::cerr << "Failed with MySQL" << std::endl;
+    test_selfhosting_cleanup();
+    return EXIT_FAILURE;
+  }
+
   return EXIT_SUCCESS;
 }
 



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