[svn] commit: r929 - in /trunk/src/lib/config/cpp: config_data.cc config_data_unittests.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Feb 23 16:12:56 UTC 2010
Author: jelte
Date: Tue Feb 23 16:12:56 2010
New Revision: 929
Log:
ok that should actually be an exception (also added test for that)
Modified:
trunk/src/lib/config/cpp/config_data.cc
trunk/src/lib/config/cpp/config_data_unittests.cc
Modified: trunk/src/lib/config/cpp/config_data.cc
==============================================================================
--- trunk/src/lib/config/cpp/config_data.cc (original)
+++ trunk/src/lib/config/cpp/config_data.cc Tue Feb 23 16:12:56 2010
@@ -31,7 +31,7 @@
{
//std::cout << "[XX] find_spec_part for " << identifier << std::endl;
if (!spec) {
- return ElementPtr();
+ dns_throw(DataNotFoundError, "Empty specification");
}
//std::cout << "in: " << std::endl << spec << std::endl;
ElementPtr spec_part = spec;
Modified: trunk/src/lib/config/cpp/config_data_unittests.cc
==============================================================================
--- trunk/src/lib/config/cpp/config_data_unittests.cc (original)
+++ trunk/src/lib/config/cpp/config_data_unittests.cc Tue Feb 23 16:12:56 2010
@@ -38,8 +38,8 @@
}
TEST(ConfigData, getValue) {
- ModuleSpec spec2 = moduleSpecFromFile(std::string(TEST_DATA_PATH) + "/spec22.spec");
- ConfigData cd = ConfigData(spec2);
+ ModuleSpec spec22 = moduleSpecFromFile(std::string(TEST_DATA_PATH) + "/spec22.spec");
+ ConfigData cd = ConfigData(spec22);
//std::cout << "[XX] SPEC2: " << cd.getModuleSpec().getFullSpec() << std::endl;
bool is_default;
//ElementPtr value = cd.getValue(is_default, "item1");
@@ -74,6 +74,12 @@
EXPECT_THROW(cd.getValue("value6/a")->str(), DataNotFoundError);
EXPECT_THROW(cd.getValue("value6/no_such_item")->str(), DataNotFoundError);
EXPECT_THROW(cd.getValue("value8/a")->str(), DataNotFoundError);
+ EXPECT_THROW(cd.getValue("value8/a")->str(), DataNotFoundError);
+ EXPECT_THROW(cd.getValue("value8/a")->str(), DataNotFoundError);
+
+ ModuleSpec spec1 = moduleSpecFromFile(std::string(TEST_DATA_PATH) + "/spec1.spec");
+ ConfigData cd1 = ConfigData(spec1);
+ EXPECT_THROW(cd1.getValue("anything")->str(), DataNotFoundError);
}
TEST(ConfigData, setLocalConfig) {
More information about the bind10-changes
mailing list