Update test to work correctly with new behaviour.
Also add a test to verify that we throw when we are supposed to.
This commit is contained in:
parent
3dd2d565fc
commit
c4e9b06569
@ -73,6 +73,7 @@ BOOST_AUTO_TEST_CASE(commandline_syntax_init)
|
|||||||
"/slashtopitem=anotherstring\n"
|
"/slashtopitem=anotherstring\n"
|
||||||
"/topitem=somestring\n";
|
"/topitem=somestring\n";
|
||||||
BOOST_CHECK(os.str() == correct_answer);
|
BOOST_CHECK(os.str() == correct_answer);
|
||||||
|
BOOST_CHECK(p.unhandledArguments().empty());
|
||||||
|
|
||||||
// Tests that only run in debug mode.
|
// Tests that only run in debug mode.
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -88,7 +89,7 @@ BOOST_AUTO_TEST_CASE(xml_syntax_init)
|
|||||||
"/group/item=overridingstring",
|
"/group/item=overridingstring",
|
||||||
"unhandledargument" };
|
"unhandledargument" };
|
||||||
const std::size_t argc = sizeof(argv)/sizeof(argv[0]);
|
const std::size_t argc = sizeof(argv)/sizeof(argv[0]);
|
||||||
parameter::ParameterGroup p(argc, argv);
|
parameter::ParameterGroup p(argc, argv, false);
|
||||||
BOOST_CHECK(p.get<std::string>("topitem") == "somestring");
|
BOOST_CHECK(p.get<std::string>("topitem") == "somestring");
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
p.writeParamToStream(os);
|
p.writeParamToStream(os);
|
||||||
@ -105,3 +106,15 @@ BOOST_AUTO_TEST_CASE(xml_syntax_init)
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(failing_strict_xml_syntax_init)
|
||||||
|
{
|
||||||
|
typedef const char* cp;
|
||||||
|
cp argv[] = { "program_command",
|
||||||
|
"testdata.xml",
|
||||||
|
"/group/item=overridingstring",
|
||||||
|
"unhandledargument" };
|
||||||
|
const std::size_t argc = sizeof(argv)/sizeof(argv[0]);
|
||||||
|
BOOST_CHECK_THROW(parameter::ParameterGroup p(argc, argv), std::runtime_error);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user