[glom] test_selfhosting_new_empty(): Also test DbUtils::get_unused_database_name().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] test_selfhosting_new_empty(): Also test DbUtils::get_unused_database_name().
- Date: Fri, 2 Dec 2011 10:10:54 +0000 (UTC)
commit 4772a97adf55187d3b72b1818401c12853bd82be
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Dec 2 11:10:43 2011 +0100
test_selfhosting_new_empty(): Also test DbUtils::get_unused_database_name().
* glom/libglom/db_utils.cc: get_unused_database_name(): Remove debug output.
* tests/test_selfhosting_new_empty.cc: Excercise DbUtils::get_unused_database_name(),
though we do not test it yet when the first choice already exists.
ChangeLog | 14 +++++++++++---
glom/libglom/db_utils.cc | 2 +-
tests/test_selfhosting_new_empty.cc | 10 +++++++++-
3 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c9d09bc..52ce63c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,19 @@
2011-12-02 Murray Cumming <murrayc murrayc com>
+ test_selfhosting_new_empty(): Also test DbUtils::get_unused_database_name().
+
+ * glom/libglom/db_utils.cc: get_unused_database_name(): Remove debug output.
+ * tests/test_selfhosting_new_empty.cc: Excercise DbUtils::get_unused_database_name(),
+ though we do not test it yet when the first choice already exists.
+
+2011-12-02 Murray Cumming <murrayc murrayc com>
+
test_selfhosting_new_empty(): Correct and expand.
* tests/test_selfhosting_new_empty.cc: Fix a CENTRAL->SELF typo. This
- probably only appeared to work before because no database cluster was really
- being initialized. Also actually create a database in the database cluster
- and set its system preferences table's record.
+ probably only appeared to work before because no database cluster was really
+ being initialized. Also actually create a database in the database cluster
+ and set its system preferences table's record.
2011-12-01 Murray Cumming <murrayc murrayc com>
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 07c2224..5f6cdb7 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -1876,7 +1876,7 @@ Glib::ustring get_unused_database_name(const Glib::ustring& base_name)
else
{
//We assume that the connection failed because the database does not exist.
- std::cout << "debug: " << G_STRFUNC << ": unused database name successfully found: " << database_name_possible << std::endl;
+ //std::cout << "debug: " << G_STRFUNC << ": unused database name successfully found: " << database_name_possible << std::endl;
return database_name_possible;
}
}
diff --git a/tests/test_selfhosting_new_empty.cc b/tests/test_selfhosting_new_empty.cc
index 9f827c4..743ec35 100644
--- a/tests/test_selfhosting_new_empty.cc
+++ b/tests/test_selfhosting_new_empty.cc
@@ -119,9 +119,17 @@ static bool test(Glom::Document::HostingMode hosting_mode)
}
g_assert(started == Glom::ConnectionPool::Backend::STARTUPERROR_NONE);
+ //Test this function a little:
+ const Glib::ustring db_name = Glom::DbUtils::get_unused_database_name("test_db");
+ if(db_name.empty())
+ {
+ std::cerr << "DbUtils::get_unused_database_name) failed." << std::endl;
+ cleanup();
+ return false;
+ }
//Create a database:
- const bool created = Glom::DbUtils::create_database(&document, "test_db",
+ const bool created = Glom::DbUtils::create_database(&document, db_name,
"test title", sigc::ptr_fun(&on_db_creation_progress));
if(!created)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]