testing menu parser
This commit is contained in:
parent
e5c0b02496
commit
955c2358fb
1 changed files with 31 additions and 0 deletions
31
src/tests/parsertest.cc
Normal file
31
src/tests/parsertest.cc
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "../FbMenuParser.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2) {
|
||||
cerr<<"you must supply an argument!"<<endl;
|
||||
exit(0);
|
||||
}
|
||||
cerr<<"Loading: "<<argv[1]<<endl;
|
||||
Parser *p = new FbMenuParser(argv[1]);
|
||||
if (!p->isLoaded()) {
|
||||
cerr<<"Couldn't load file: "<<argv[1]<<endl;
|
||||
delete p;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Parser::Item item, item2, item3;
|
||||
int args = 0;
|
||||
int last_line_num = 0;
|
||||
std::string last_line;
|
||||
std::string type, name, argument;
|
||||
while (!p->eof()) {
|
||||
(*p)>>item>>item2>>item3;
|
||||
cerr<<item.second<<","<<item2.second<<", "<<item3.second<<endl;
|
||||
}
|
||||
delete p;
|
||||
}
|
Loading…
Reference in a new issue