From: <net...@us...> - 2003-04-29 10:01:28
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv1040/src/rftaparser Modified Files: DeclarationParserTest.h DeclarationParserTest.cpp Log Message: -- additional test for 'operator' keyword Index: DeclarationParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParserTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DeclarationParserTest.h 26 Apr 2003 10:50:16 -0000 1.2 --- DeclarationParserTest.h 29 Apr 2003 10:01:25 -0000 1.3 *************** *** 30,33 **** --- 30,34 ---- CPPUNIT_TEST( testTemplateFuntion ); CPPUNIT_TEST( testNestedTemplateClass ); + CPPUNIT_TEST( testOperatorMember ); CPPUNIT_TEST_SUITE_END(); *************** *** 55,58 **** --- 56,60 ---- void testTemplateFuntion(); void testNestedTemplateClass(); + void testOperatorMember(); private: Index: DeclarationParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParserTest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DeclarationParserTest.cpp 26 Apr 2003 10:50:17 -0000 1.4 --- DeclarationParserTest.cpp 29 Apr 2003 10:01:25 -0000 1.5 *************** *** 7,10 **** --- 7,11 ---- #include "stdafx.h" #include "DeclarationParserTest.h" + #include "KeyedString.h" #include <rfta/parser/ASTNodes.h> #include <rfta/parser/DeclarationParser.h> *************** *** 278,281 **** --- 279,309 ---- startIndex, endIndex-startIndex ); + } + + void + DeclarationParserTest::testOperatorMember() + { + Testing::KeyedString source; + source.setKeyStart("FUNCTION"); + source << "inline "; + source.addKeyed("DECLARATOR" , "KeyedString::operator std::string() const" ) << " "; + source.addKeyed("FUNCTIONBODY","{ return sequence_; }"); + source.setKeyEnd("FUNCTION"); + source << " "; + + SourceASTNodePtr sourceAST = RFTA_ASSERT_PARSER_PASS( DeclarationParser, + source, + source.length()-2 ); + + RFTA_ASSERT_NODE_HAS( sourceAST->getChildAt(0), + ASTNodeTypes::functionImplementation, + source.getKeyedIndex("FUNCTION",0), + source.getKeyedLen("FUNCTION",0) ); + + // check AST: + //RFTA_ASSERT_DECLARATION( source, sourceAST ); + + // check declarator types: + //RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } |