[glom] Rename a test utility function.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Rename a test utility function.
- Date: Mon, 7 Nov 2011 12:05:36 +0000 (UTC)
commit 7e7dfddb91c3ac25afab1eff958255afad9823a7
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Nov 7 11:54:42 2011 +0100
Rename a test utility function.
* tests/test_selfhosting_utils.[h|cc]: Rename
test_create_and_selfhost() to test_create_and_selfhost_from_example().
* tests/test_selfhosting_new_from_example.cc:
* tests/test_selfhosting_new_then_get_privs.cc:
* tests/test_selfhosting_new_then_image.cc:
* tests/test_selfhosting_new_then_report.cc:
* tests/test_selfhosting_sqlinjection.cc: Adapated.
ChangeLog | 12 ++++++++++
tests/test_selfhosting_new_from_example.cc | 2 +-
tests/test_selfhosting_new_then_get_privs.cc | 2 +-
tests/test_selfhosting_new_then_image.cc | 2 +-
tests/test_selfhosting_new_then_report.cc | 2 +-
tests/test_selfhosting_sqlinjection.cc | 2 +-
tests/test_selfhosting_utils.cc | 29 +++++++++++++------------
tests/test_selfhosting_utils.h | 8 ++++++-
8 files changed, 39 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4ea1934..74df90b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-11-07 Murray Cumming <murrayc murrayc com>
+
+ Rename a test utility function.
+
+ * tests/test_selfhosting_utils.[h|cc]: Rename
+ test_create_and_selfhost() to test_create_and_selfhost_from_example().
+ * tests/test_selfhosting_new_from_example.cc:
+ * tests/test_selfhosting_new_then_get_privs.cc:
+ * tests/test_selfhosting_new_then_image.cc:
+ * tests/test_selfhosting_new_then_report.cc:
+ * tests/test_selfhosting_sqlinjection.cc: Adapated.
+
2011-11-06 Murray Cumming <murrayc murrayc com>
Require libgda 5.0.2
diff --git a/tests/test_selfhosting_new_from_example.cc b/tests/test_selfhosting_new_from_example.cc
index c2c81b0..701edf0 100644
--- a/tests/test_selfhosting_new_from_example.cc
+++ b/tests/test_selfhosting_new_from_example.cc
@@ -30,7 +30,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
{
Glom::Document document;
const bool recreated =
- test_create_and_selfhost("example_music_collection.glom", document, hosting_mode);
+ test_create_and_selfhost_from_example("example_music_collection.glom", document, hosting_mode);
if(!recreated)
{
std::cerr << "Recreation failed." << std::endl;
diff --git a/tests/test_selfhosting_new_then_get_privs.cc b/tests/test_selfhosting_new_then_get_privs.cc
index cedda77..95c4707 100644
--- a/tests/test_selfhosting_new_then_get_privs.cc
+++ b/tests/test_selfhosting_new_then_get_privs.cc
@@ -28,7 +28,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
{
Glom::Document document;
const bool recreated =
- test_create_and_selfhost("example_smallbusiness.glom", document, hosting_mode);
+ test_create_and_selfhost_from_example("example_smallbusiness.glom", document, hosting_mode);
if(!recreated)
{
std::cerr << "Recreation failed." << std::endl;
diff --git a/tests/test_selfhosting_new_then_image.cc b/tests/test_selfhosting_new_then_image.cc
index 9367052..bf0ead2 100644
--- a/tests/test_selfhosting_new_then_image.cc
+++ b/tests/test_selfhosting_new_then_image.cc
@@ -34,7 +34,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
{
Glom::Document document;
const bool recreated =
- test_create_and_selfhost("example_smallbusiness.glom", document, hosting_mode);
+ test_create_and_selfhost_from_example("example_smallbusiness.glom", document, hosting_mode);
if(!recreated)
{
std::cerr << "Recreation failed." << std::endl;
diff --git a/tests/test_selfhosting_new_then_report.cc b/tests/test_selfhosting_new_then_report.cc
index 0d7758f..805d4ca 100644
--- a/tests/test_selfhosting_new_then_report.cc
+++ b/tests/test_selfhosting_new_then_report.cc
@@ -30,7 +30,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
{
Glom::Document document;
const bool recreated =
- test_create_and_selfhost("example_music_collection.glom", document, hosting_mode);
+ test_create_and_selfhost_from_example("example_music_collection.glom", document, hosting_mode);
if(!recreated)
{
std::cerr << "Recreation failed." << std::endl;
diff --git a/tests/test_selfhosting_sqlinjection.cc b/tests/test_selfhosting_sqlinjection.cc
index 456d6b6..4cdbd5d 100644
--- a/tests/test_selfhosting_sqlinjection.cc
+++ b/tests/test_selfhosting_sqlinjection.cc
@@ -204,7 +204,7 @@ static bool check_avoid_quotes_and_drop_table_with_false_field_type()
static bool test(Glom::Document::HostingMode hosting_mode)
{
const bool recreated =
- test_create_and_selfhost("example_music_collection.glom", document, hosting_mode);
+ test_create_and_selfhost_from_example("example_music_collection.glom", document, hosting_mode);
if(!recreated)
{
std::cerr << "Recreation failed." << std::endl;
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index ae7646d..9239070 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -138,19 +138,11 @@ void test_selfhosting_cleanup()
temp_filepath_dir.clear();
}
-
-bool test_create_and_selfhost(const std::string& example_filename, Glom::Document& document, Glom::Document::HostingMode hosting_mode)
+bool test_create_and_selfhost_from_example(const std::string& example_filename, Glom::Document& document, Glom::Document::HostingMode hosting_mode)
{
- if( (hosting_mode != Glom::Document::HOSTING_MODE_POSTGRES_SELF) &&
- (hosting_mode != Glom::Document::HOSTING_MODE_SQLITE) )
- {
- std::cerr << G_STRFUNC << ": This test function does not support the specified hosting_mode: " << hosting_mode << std::endl;
- return false;
- }
-
- // Get a URI for a test file:
Glib::ustring uri;
-
+
+ // Get a URI for the example file:
try
{
const std::string path =
@@ -163,12 +155,21 @@ bool test_create_and_selfhost(const std::string& example_filename, Glom::Documen
std::cerr << G_STRFUNC << ": " << ex.what();
return false;
}
+
+ return test_create_and_selfhost_from_uri(uri, document, hosting_mode);
+}
- //std::cout << "URI=" << uri << std::endl;
-
+bool test_create_and_selfhost_from_uri(const Glib::ustring& example_file_uri, Glom::Document& document, Glom::Document::HostingMode hosting_mode)
+{
+ if( (hosting_mode != Glom::Document::HOSTING_MODE_POSTGRES_SELF) &&
+ (hosting_mode != Glom::Document::HOSTING_MODE_SQLITE) )
+ {
+ std::cerr << G_STRFUNC << ": This test function does not support the specified hosting_mode: " << hosting_mode << std::endl;
+ return false;
+ }
// Load the document:
- document.set_file_uri(uri);
+ document.set_file_uri(example_file_uri);
int failure_code = 0;
const bool test = document.load(failure_code);
//std::cout << "Document load result=" << test << std::endl;
diff --git a/tests/test_selfhosting_utils.h b/tests/test_selfhosting_utils.h
index 5dff492..1feadf1 100644
--- a/tests/test_selfhosting_utils.h
+++ b/tests/test_selfhosting_utils.h
@@ -29,7 +29,13 @@
*
* @param hosting_mode Either HOSTING_MODE_POSTGRES_SELF or HOSTING_MODE_SQLITE
*/
-bool test_create_and_selfhost(const std::string& example_filename, Glom::Document& document, Glom::Document::HostingMode hosting_mode);
+bool test_create_and_selfhost_from_example(const std::string& example_filename, Glom::Document& document, Glom::Document::HostingMode hosting_mode);
+
+/** Create a .glom file from an existing .glom example file with database data, and start a PostgreSQL server if necessary.
+ *
+ * @param hosting_mode Either HOSTING_MODE_POSTGRES_SELF or HOSTING_MODE_SQLITE
+ */
+bool test_create_and_selfhost_from_uri(const Glib::ustring& file_uri, Glom::Document& document, Glom::Document::HostingMode hosting_mode);
bool test_model_expected_size(const Glib::RefPtr<Gnome::Gda::DataModel>& data_model, guint columns_count, guint rows_count);
bool test_table_exists(const Glib::ustring& table_name, const Glom::Document& document);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]