X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FParse.test.cc;h=9d465b7ebbde33e3620a5cbf96044658effc584b;hb=da1843a0fc5dfaea09d7d7ab3adf2d30795e04c5;hp=3f83d57265064480e2825ce5b9f85846af3168f5;hpb=c0b5c560da72983939b286632ac481e076649ddb;p=senf.git diff --git a/Console/Parse.test.cc b/Console/Parse.test.cc index 3f83d57..9d465b7 100644 --- a/Console/Parse.test.cc +++ b/Console/Parse.test.cc @@ -43,8 +43,6 @@ namespace { - - struct TestParseDispatcher { TestParseDispatcher(std::ostream & os) : os_ (os) {} @@ -75,9 +73,11 @@ namespace void builtin_cd(std::vector const & path) { os_ << "builtin_cd( " << senf::stringJoin(path, "/") << " )\n"; } void builtin_ls(std::vector const & path) - { os_ << "builtin_cd( " << senf::stringJoin(path, "/") << " )\n"; } + { os_ << "builtin_ls( " << senf::stringJoin(path, "/") << " )\n"; } void builtin_exit() { os_ << "builtin_exit()\n"; } + void builtin_help(std::vector const & path) + { os_ << "builtin_help( " << senf::stringJoin(path, "/") << " )\n"; } }; } @@ -95,10 +95,15 @@ BOOST_AUTO_UNIT_TEST(commandGrammar) "doo / bii / doo arg" " flab::blub" " 123.434>a" - " (a,b,c (huhu))" + " (a,b;c (huhu/{haha}))" " \"foo\\\"bar\" #\n" " x\"01 02 # Inner comment\n" - " 0304\""; + " 0304\";" + "ls /foo/bar;" + "cd /foo/bar;" + "exit;" + "foo/bar/ { ls; }" + "help /foo/bar"; BOOST_CHECK( boost::spirit::parse( text, @@ -113,15 +118,26 @@ BOOST_AUTO_UNIT_TEST(commandGrammar) "pushWord( a )\n" "pushPunctuation( , )\n" "pushWord( b )\n" - "pushPunctuation( , )\n" + "pushPunctuation( ; )\n" "pushWord( c )\n" "pushPunctuation( ( )\n" "pushWord( huhu )\n" + "pushPunctuation( / )\n" + "pushPunctuation( { )\n" + "pushWord( haha )\n" + "pushPunctuation( } )\n" "pushPunctuation( ) )\n" "closeGroup()\n" "pushArgument( foo\"bar )\n" "pushArgument( \x01\x02\x03\x04 )\n" - "endCommand()\n" ); + "endCommand()\n" + "builtin_ls( /foo/bar )\n" + "builtin_cd( /foo/bar )\n" + "builtin_exit()\n" + "pushDirectory( foo/bar/ )\n" + "builtin_ls( )\n" + "popDirectory()\n" + "builtin_help( /foo/bar )\n" ); } namespace {