BIND 10 trac2355, updated. f3259cf183a8bea65acad690b50982057f24abe5 [2355] Removed element type checking from StringParser::build. This broke a unit test in DHCP4, and it appears we rely on being able to set a string configuration value from any element type.
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri May 3 14:34:06 UTC 2013
The branch, trac2355 has been updated
via f3259cf183a8bea65acad690b50982057f24abe5 (commit)
from 36d8374051ef3df79035debd0bcdf63016d0aa85 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f3259cf183a8bea65acad690b50982057f24abe5
Author: Thomas Markwalder <tmark at isc.org>
Date: Fri May 3 10:32:39 2013 -0400
[2355] Removed element type checking from StringParser::build. This broke
a unit test in DHCP4, and it appears we rely on being able to set a string
configuration value from any element type.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcpsrv/dhcp_parsers.cc | 10 ----------
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc | 10 +++++-----
2 files changed, 5 insertions(+), 15 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcpsrv/dhcp_parsers.cc b/src/lib/dhcpsrv/dhcp_parsers.cc
index 4e5a23c..76e7069 100644
--- a/src/lib/dhcpsrv/dhcp_parsers.cc
+++ b/src/lib/dhcpsrv/dhcp_parsers.cc
@@ -173,18 +173,8 @@ StringParser::StringParser(const std::string& param_name,
}
void StringParser::build(ConstElementPtr value) {
-#if 0
value_ = value->str();
boost::erase_all(value_, "\"");
-#else
- try {
- value_ = value->stringValue();
- boost::erase_all(value_, "\"");
- } catch (const isc::data::TypeError &) {
- isc_throw(BadValue, " Wrong value type for " << param_name_
- << " : build called with a non-boolean element.");
- }
-#endif
}
void StringParser::commit() {
diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
index 480e55a..13aac24 100644
--- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
+++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
@@ -97,7 +97,7 @@ TEST_F(DhcpParserTest, booleanParserTest) {
///
/// Verifies that the parser:
/// 1. Does not allow empty for storage.
-/// 2. Rejects a non-string element.
+/// 2. Builds with a nont string value.
/// 3. Builds with a string value.
/// 4. Updates storage upon commit.
TEST_F(DhcpParserTest, stringParserTest) {
@@ -112,13 +112,13 @@ TEST_F(DhcpParserTest, stringParserTest) {
StringStoragePtr storage(new StringStorage());
StringParser parser(name, storage);
- // Verify that parser with rejects a non-string element.
- ElementPtr wrong_element = Element::create(9999);
- EXPECT_THROW(parser.build(wrong_element), isc::BadValue);
+ // Verify that parser with accepts a non-string element.
+ ElementPtr element = Element::create(9999);
+ EXPECT_NO_THROW(parser.build(element));
// Verify that parser will build with a string value.
const std::string test_value = "test value";
- ElementPtr element = Element::create(test_value);
+ element = Element::create(test_value);
ASSERT_NO_THROW(parser.build(element));
// Verify that commit updates storage.
More information about the bind10-changes
mailing list