From: <net...@us...> - 2003-05-16 10:00:02
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv30288/src/rftaparser Modified Files: UnparsedDeclarationMutatorTest.h UnparsedDeclarationMutatorTest.cpp Log Message: -- additional test for bug that was introduced by new declarator parser -- testing now new property and node type of pure-specifier Index: UnparsedDeclarationMutatorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UnparsedDeclarationMutatorTest.h 4 May 2003 06:56:48 -0000 1.8 --- UnparsedDeclarationMutatorTest.h 16 May 2003 09:59:57 -0000 1.9 *************** *** 53,56 **** --- 53,57 ---- CPPUNIT_TEST( testMemberConstInit ); CPPUNIT_TEST( testStructBitfield ); + CPPUNIT_TEST( testEmptyParameterList ); CPPUNIT_TEST_SUITE_END(); *************** *** 100,103 **** --- 101,105 ---- void testStructBitfield(); void testOperatorMember(); + void testEmptyParameterList(); private: Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** UnparsedDeclarationMutatorTest.cpp 10 May 2003 13:11:06 -0000 1.13 --- UnparsedDeclarationMutatorTest.cpp 16 May 2003 09:59:57 -0000 1.14 *************** *** 768,772 **** source.addKeyed(SPECIFIER , "const" ) << " "; source.addKeyed(SPECIFIER , "vector<int>" ) << " "; ! source.addKeyed(DECLARATOR, "& func(class s::t v=0,int i=-1) = 0" ) << ";"; SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); --- 768,776 ---- source.addKeyed(SPECIFIER , "const" ) << " "; source.addKeyed(SPECIFIER , "vector<int>" ) << " "; ! ! source.setKeyStart(DECLARATOR); ! source << "& func(class s::t v=0,int i=-1) "; ! source.addKeyed("PURESPECIFIER","= 0" ); // "pure specifier is within 'declarator' ! source.setKeyEnd(DECLARATOR) << ";"; SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); *************** *** 778,781 **** --- 782,791 ---- // check declarator types: RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); + RFTA_ASSERT_NODE_PROPERTY_HAS( node->getChildAt(0), + ASTNodeProperties::functionDeclaratorSpecifier, + ASTNodeTypes::pureSpecifier, + source.getKeyedIndex("PURESPECIFIER",0), + source.getKeyedLen("PURESPECIFIER",0) + ); } *************** *** 833,836 **** --- 843,877 ---- RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } + + void + UnparsedDeclarationMutatorTest::testEmptyParameterList() + { + Testing::KeyedString source; + source.addKeyed(SPECIFIER , "virtual" ) << " "; + source.addKeyed(SPECIFIER , "wxString") << " "; + + source.setKeyStart(DECLARATOR); + source << "GetLibraryName() "; + source.addKeyed("PURESPECIFIER","= 0" ); // "pure specifier is within 'declarator' + source.setKeyEnd (DECLARATOR); + + source << ";"; + + SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); + ASTNodePtr node = sourceAST->getChildAt(0); + + // check AST: + RFTA_ASSERT_DECLARATION( source, sourceAST ); + + // check declarator types: + RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); + RFTA_ASSERT_NODE_PROPERTY_HAS( node->getChildAt(0), + ASTNodeProperties::functionDeclaratorSpecifier, + ASTNodeTypes::pureSpecifier, + source.getKeyedIndex("PURESPECIFIER",0), + source.getKeyedLen("PURESPECIFIER",0) + ); + } + |