Index: program_options/test/options_description_test.cpp =================================================================== --- program_options/test/options_description_test.cpp (Revision 57398) +++ program_options/test/options_description_test.cpp (Arbeitskopie) @@ -22,7 +22,7 @@ options_description desc; desc.add_options() ("foo", value(), "") - ("bar", value(), "") + ("bar", value(), "") ; const typed_value_base* b = dynamic_cast @@ -33,7 +33,7 @@ const typed_value_base* b2 = dynamic_cast (desc.find("bar", false).semantic().get()); BOOST_CHECK(b2); - BOOST_CHECK(b2->value_type() == typeid(std::string)); + BOOST_CHECK(b2->value_type() == typeid(string)); } void test_approximation() @@ -70,10 +70,45 @@ "foo foo foo foo foo foo foo foo foo foo foo foo foo foo" "foo foo foo foo foo foo foo foo foo foo foo foo foo foo" "foo foo foo foo foo foo foo foo foo foo foo foo foo foo" - "foo foo foo foo foo foo foo foo foo foo foo foo foo foo"); + "foo foo foo foo foo foo foo foo foo foo foo foo foo foo") + ("list", new untyped_value(), + "a list:\n \t" + "item1, item2, item3, item4, item5, item6, item7, item8, item9, " + "item10, item11, item12, item13, item14, item15, item16, item17, item18") + ("well_formated", new untyped_value(), + "As you can see this is a very well formatted option description.\n" + "You can do this for example:\n\n" + "Values:\n" + " Value1: \tdoes this and that, bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla\n" + " Value2: \tdoes something else, bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla\n\n" + " This paragraph has a first line indent only, bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") + ; stringstream ss; ss << desc; + BOOST_CHECK_EQUAL(ss.str(), +" --test arg foo foo foo foo foo foo foo foo foo foo foo foo foo \n" +" foofoo foo foo foo foo foo foo foo foo foo foo foo foo \n" +" foofoo foo foo foo foo foo foo foo foo foo foo foo foo \n" +" foofoo foo foo foo foo foo foo foo foo foo foo foo foo \n" +" foo\n" +" --list arg a list:\n" +" item1, item2, item3, item4, item5, item6, item7, \n" +" item8, item9, item10, item11, item12, item13, item14, \n" +" item15, item16, item17, item18\n" +" --well_formated arg As you can see this is a very well formatted option \n" +" description.\n" +" You can do this for example:\n" +" \n" +" Values:\n" +" Value1: does this and that, bla bla bla bla bla bla \n" +" bla bla bla bla bla bla bla bla bla\n" +" Value2: does something else, bla bla bla bla bla bla \n" +" bla bla bla bla bla bla bla bla bla\n" +" \n" +" This paragraph has a first line indent only, bla \n" +" bla bla bla bla bla bla bla bla bla bla bla bla bla bla\n" + ); } void test_long_default_value() @@ -81,16 +116,16 @@ options_description desc; desc.add_options() ("cfgfile,c", - value()->default_value("/usr/local/etc/myprogramXXXXXXXXX/configuration.conf"), - "the configfile"); + value()->default_value("/usr/local/etc/myprogramXXXXXXXXX/configuration.conf"), + "the configfile") + ; stringstream ss; ss << desc; BOOST_CHECK_EQUAL(ss.str(), " -c [ --cfgfile ] arg (=/usr/local/etc/myprogramXXXXXXXXX/configuration.conf)\n" " the configfile\n" - ); - + ); } int main(int, char* [])