From: <bl...@us...> - 2003-05-03 22:23:23
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv29751/src/rftaparser Modified Files: MacroDeclarationParser.cpp MacroDeclarationParserTest.cpp MacroDeclarationParserTest.h Log Message: * better macro detection (must be suffixed by (...)) Index: MacroDeclarationParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/MacroDeclarationParser.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MacroDeclarationParser.cpp 3 May 2003 21:52:15 -0000 1.1 --- MacroDeclarationParser.cpp 3 May 2003 22:23:19 -0000 1.2 *************** *** 46,50 **** Xtl::CStringView parameters( current ); if ( *current != '(' ) ! throw ParserTools::ParseError( "expected '(' after macro name not found.", current ); ParserTools::findNextBalanced( ++current, '(', ')' ); --- 46,50 ---- Xtl::CStringView parameters( current ); if ( *current != '(' ) ! return false; ParserTools::findNextBalanced( ++current, '(', ')' ); Index: MacroDeclarationParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/MacroDeclarationParserTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MacroDeclarationParserTest.cpp 3 May 2003 21:52:15 -0000 1.1 --- MacroDeclarationParserTest.cpp 3 May 2003 22:23:19 -0000 1.2 *************** *** 99,101 **** --- 99,125 ---- + void + MacroDeclarationParserTest::testFailIfNotUpperCase() + { + addMacroDeclaration( "someMethod", "", "()", "" ); + RFTA_ASSERT_PARSER_FAIL( MacroDeclarationParser, source_ ); + } + + + void + MacroDeclarationParserTest::testFailIfUpperButNoUnderScore() + { + addMacroDeclaration( "TYPE", "", "()", "" ); + RFTA_ASSERT_PARSER_FAIL( MacroDeclarationParser, source_ ); + } + + + void + MacroDeclarationParserTest::testFailIfNoBrace() + { + addMacroDeclaration( "EXPORT_STUFF", "", "", "" ); + RFTA_ASSERT_PARSER_FAIL( MacroDeclarationParser, source_ ); + } + + } // namespace Refactoring Index: MacroDeclarationParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/MacroDeclarationParserTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MacroDeclarationParserTest.h 3 May 2003 21:52:15 -0000 1.1 --- MacroDeclarationParserTest.h 3 May 2003 22:23:19 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- CPPUNIT_TEST( testMacroDeclarationWithParameters ); CPPUNIT_TEST( testMacroDeclarationWithTrailingSemiColon ); + CPPUNIT_TEST( testFailIfNotUpperCase ); + CPPUNIT_TEST( testFailIfUpperButNoUnderScore ); + CPPUNIT_TEST( testFailIfNoBrace ); CPPUNIT_TEST_SUITE_END(); *************** *** 36,39 **** --- 39,45 ---- void testMacroDeclarationWithParameters(); void testMacroDeclarationWithTrailingSemiColon(); + void testFailIfNotUpperCase(); + void testFailIfUpperButNoUnderScore(); + void testFailIfNoBrace(); private: |