mirror of
https://github.com/boostorg/property_map.git
synced 2026-01-19 04:22:15 +00:00
cover a few more branches in the header
This commit is contained in:
committed by
Jim King
parent
cf956e50b7
commit
fda9231a89
@@ -102,7 +102,7 @@ struct dynamic_get_failure : public dynamic_property_exception {
|
||||
if(statement.empty())
|
||||
statement =
|
||||
std::string(
|
||||
"dynamic property get cannot retrieve value for property: ")
|
||||
"dynamic property get cannot retrieve value for property: ")
|
||||
+ property + ".";
|
||||
|
||||
return statement.c_str();
|
||||
|
||||
@@ -87,6 +87,14 @@ int main() {
|
||||
#endif
|
||||
BOOST_TEST(get("int",properties,std::string("one"), type<int>()) == 1);
|
||||
BOOST_TEST(get("double",properties,5.3) == "five point three");
|
||||
try {
|
||||
get("not_there",properties,"");
|
||||
BOOST_ERROR("No exception thrown.");
|
||||
} catch (boost::dynamic_get_failure& ex) {
|
||||
BOOST_TEST_CSTR_EQ(ex.what(), "dynamic property get cannot retrieve value for property: not_there.");
|
||||
// test idempotent error string generator branch
|
||||
BOOST_TEST_CSTR_EQ(ex.what(), "dynamic property get cannot retrieve value for property: not_there.");
|
||||
}
|
||||
}
|
||||
|
||||
// Put tests
|
||||
@@ -117,7 +125,11 @@ int main() {
|
||||
try {
|
||||
put("nada",properties,3.14,std::string("3.14159"));
|
||||
BOOST_ERROR("No exception thrown.");
|
||||
} catch (boost::property_not_found&) { }
|
||||
} catch (boost::property_not_found& ex) {
|
||||
BOOST_TEST_CSTR_EQ(ex.what(), "Property not found: nada.");
|
||||
// test idempotent error string generator branch
|
||||
BOOST_TEST_CSTR_EQ(ex.what(), "Property not found: nada.");
|
||||
}
|
||||
}
|
||||
|
||||
// Nonexistent property gets generated
|
||||
|
||||
Reference in New Issue
Block a user