// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief ParsedCommand.test unit tests */
+ \brief ParsedCommand unit tests */
//#include "ParsedCommand.test.hh"
//#include "ParsedCommand.test.ih"
// Just for the fun of it, use a functor and not a function pointer as parser ...
dir.add("cb6", &cb5)
.arg( kw::parser = TestParser() );
- BOOST_CHECK_NO_THROW(
+ SENF_CHECK_NO_THROW(
parser.parse("test/cb6 false",
boost::bind<void>( boost::ref(executor), boost::ref(ss), _1 )) );
BOOST_CHECK_EQUAL( ss.str(), "Value: true\n" );
// compatible types also work
dir.add("cb7", boost::function<float()>(&cb2))
.formatter( &testFormatter );
- BOOST_CHECK_NO_THROW(
+ SENF_CHECK_NO_THROW(
parser.parse("test/cb7",
boost::bind<void>( boost::ref(executor), boost::ref(ss), _1 )) );
BOOST_CHECK_EQUAL( ss.str(), "formatter\n" );
"lux sto ioco. Per Re dono. Copiose reus scitus jus diligens sis scapulare\n"
"Servitium transi." )
+ .shortdoc(
+ "Ops fortunate." )
+
.overloadDoc(
"Lo nam balnearius Opprimo Pennatus, no decentia sui, dicto esse se pulchritudo,\n"
"pupa Sive res indifferenter. Captivo pa." )
(void) cbNode;
- BOOST_CHECK_NO_THROW(
+ SENF_CHECK_NO_THROW(
parser.parse("test/cb 111 222.4",
boost::bind<void>( boost::ref(executor), boost::ref(ss), _1 )) );
- BOOST_CHECK_NO_THROW(
+ SENF_CHECK_NO_THROW(
parser.parse("test/cb 222",
boost::bind<void>( boost::ref(executor), boost::ref(ss), _1 )) );
- BOOST_CHECK_NO_THROW(
+ SENF_CHECK_NO_THROW(
parser.parse("test/cb foo",
boost::bind<void>( boost::ref(executor), boost::ref(ss), _1 )) );
- BOOST_CHECK_NO_THROW(
+ SENF_CHECK_NO_THROW(
parser.parse("test/cb",
boost::bind<void>( boost::ref(executor), boost::ref(ss), _1 )) );
BOOST_CHECK_EQUAL( ss.str(), "333\n" "224\n" "Value: foo\n" "Value: \n" );
+
+ BOOST_CHECK_EQUAL( dir("cb").shorthelp(), "Ops fortunate." );
}
{
}
}
+namespace {
+
+ senf::console::DirectoryNode::ptr dircb()
+ {
+ senf::console::DirectoryNode & dir (
+ senf::console::root()["test"].mkdir("dircb"));
+ dir.add("cb1", &cb1);
+ return dir.thisptr();
+ }
+
+}
+
+BOOST_AUTO_UNIT_TEST(directoryReturn)
+{
+ senf::console::Executor executor;
+ senf::console::CommandParser parser;
+ senf::console::ScopedDirectory<> dir;
+ senf::console::root().add("test", dir);
+ dir.add("test", &dircb);
+
+ {
+ std::stringstream ss;
+ SENF_CHECK_NO_THROW(
+ parser.parse("test/test { ls; }",
+ boost::bind<void>( boost::ref(executor), boost::ref(ss), _1 )) );
+ BOOST_CHECK_EQUAL( ss.str(), "<Directory at '/test/dircb'>\ncb1\n" );
+ }
+
+}
+
#ifdef COMPILE_CHECK
COMPILE_FAIL(argParser)