|
From: <net...@us...> - 2003-05-15 16:29:16
|
Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv17550/src/rfta
Modified Files:
VariableDeclVisitorTest.cpp VariableDeclCollectorTest.cpp
ToolsBoxTest.cpp SourceBasedTestBase.h SourceBasedTestBase.cpp
IdentifierVisitorTest.cpp IdentifierResolverTest.cpp
IdentifierResolverContextTest.cpp CodeWriterTestBase.cpp
CodeModelGeneratorTest.cpp
Log Message:
-- modified SourceBasedTestBase to support different Parsers
Index: VariableDeclVisitorTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/VariableDeclVisitorTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** VariableDeclVisitorTest.cpp 27 Oct 2002 19:04:32 -0000 1.2
--- VariableDeclVisitorTest.cpp 15 May 2003 16:29:12 -0000 1.3
***************
*** 7,11 ****
#include "VariableDeclVisitorTest.h"
#include <rfta/parser/ASTNodes.h>
!
namespace Refactoring
--- 7,11 ----
#include "VariableDeclVisitorTest.h"
#include <rfta/parser/ASTNodes.h>
! #include <rfta/Parser/StatementsParser.h>
namespace Refactoring
***************
*** 43,47 ****
VariableDeclVisitorTest::visitAndVerifyExpectations()
{
! parse();
visitNode( sourceNode_ );
verify();
--- 43,47 ----
VariableDeclVisitorTest::visitAndVerifyExpectations()
{
! parse((StatementsParser*)0);
visitNode( sourceNode_ );
verify();
Index: VariableDeclCollectorTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/VariableDeclCollectorTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** VariableDeclCollectorTest.cpp 22 Dec 2002 16:03:53 -0000 1.2
--- VariableDeclCollectorTest.cpp 15 May 2003 16:29:12 -0000 1.3
***************
*** 6,10 ****
#include "stdafx.h"
#include "VariableDeclCollectorTest.h"
!
namespace Refactoring
--- 6,10 ----
#include "stdafx.h"
#include "VariableDeclCollectorTest.h"
! #include <rfta/Parser/StatementsParser.h>
namespace Refactoring
***************
*** 73,77 ****
int zIndex = source_.length();
source_ += "z; } }";
! parse();
CPPUNIT_ASSERT( collector_->collect( sourceNode_ ) );
--- 73,77 ----
int zIndex = source_.length();
source_ += "z; } }";
! parse((StatementsParser*)0);
CPPUNIT_ASSERT( collector_->collect( sourceNode_ ) );
Index: ToolsBoxTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/ToolsBoxTest.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ToolsBoxTest.cpp 27 Apr 2003 22:02:03 -0000 1.15
--- ToolsBoxTest.cpp 15 May 2003 16:29:12 -0000 1.16
***************
*** 11,14 ****
--- 11,15 ----
#include <rfta/parser/ASTNodes.h>
#include <rfta/parser/ParserTools.h>
+ #include <rfta/Parser/StatementsParser.h>
***************
*** 99,103 ****
source_ += "xyz = 123; }";
! parse();
std::string identifier = ToolsBox::getIdentifierAt( identifierIndex,
--- 100,104 ----
source_ += "xyz = 123; }";
! parse((StatementsParser*)0);
std::string identifier = ToolsBox::getIdentifierAt( identifierIndex,
***************
*** 114,118 ****
source_ += "yz = 123; }";
! parse();
std::string identifier = ToolsBox::getIdentifierAt( identifierIndex,
--- 115,119 ----
source_ += "yz = 123; }";
! parse((StatementsParser*)0);
std::string identifier = ToolsBox::getIdentifierAt( identifierIndex,
***************
*** 128,132 ****
int identifierIndex = source_.length()-2;
! parse();
std::string identifier = ToolsBox::getIdentifierAt( identifierIndex,
--- 129,133 ----
int identifierIndex = source_.length()-2;
! parse((StatementsParser*)0);
std::string identifier = ToolsBox::getIdentifierAt( identifierIndex,
***************
*** 144,148 ****
" x+= 3;"
"}";
! parse();
ASTNodePtr variable = ToolsBox::findVariableDeclFor( "x",
--- 145,149 ----
" x+= 3;"
"}";
! parse((StatementsParser*)0);
ASTNodePtr variable = ToolsBox::findVariableDeclFor( "x",
***************
*** 166,170 ****
" x+= 3;"
"}";
! parse();
ASTNodePtr variable = ToolsBox::findVariableDeclFor( "x",
--- 167,171 ----
" x+= 3;"
"}";
! parse((StatementsParser*)0);
ASTNodePtr variable = ToolsBox::findVariableDeclFor( "x",
***************
*** 183,187 ****
" x+= 3;"
"}";
! parse();
ToolsBox::SourceRangeList occurrences;
--- 184,188 ----
" x+= 3;"
"}";
! parse((StatementsParser*)0);
ToolsBox::SourceRangeList occurrences;
***************
*** 204,208 ****
int index2 = source_.length();
source_ += "x+= 3;";
! parse();
ToolsBox::SourceRangeList occurrences;
--- 205,209 ----
int index2 = source_.length();
source_ += "x+= 3;";
! parse((StatementsParser*)0);
ToolsBox::SourceRangeList occurrences;
***************
*** 227,231 ****
int identifierLength = identifier.length();
source_ += identifier + "=3;";
! parse();
SourceRange range(ParserTools::findIdentifier(source_.c_str(),
source_.c_str() + source_.size(),
--- 228,232 ----
int identifierLength = identifier.length();
source_ += identifier + "=3;";
! parse((StatementsParser*)0);
SourceRange range(ParserTools::findIdentifier(source_.c_str(),
source_.c_str() + source_.size(),
***************
*** 257,261 ****
source_ += identifier + "=3;"
" }";
! parse();
ToolsBox::SourceRangeList occurrences;
--- 258,262 ----
source_ += identifier + "=3;"
" }";
! parse((StatementsParser*)0);
ToolsBox::SourceRangeList occurrences;
***************
*** 274,278 ****
{
source_ = "int abc_, _abc, abc, xabcy, abd;";
! parse();
ToolsBox::SourceRangeList occurrences;
const std::string identifier( "abc" );
--- 275,279 ----
{
source_ = "int abc_, _abc, abc, xabcy, abd;";
! parse((StatementsParser*)0);
ToolsBox::SourceRangeList occurrences;
const std::string identifier( "abc" );
***************
*** 304,308 ****
"x = 3;" );
! parse();
ASTNodePtr compoundNode = sourceNode_->getChildAt(1);
--- 305,309 ----
"x = 3;" );
! parse((StatementsParser*)0);
ASTNodePtr compoundNode = sourceNode_->getChildAt(1);
Index: SourceBasedTestBase.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SourceBasedTestBase.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SourceBasedTestBase.h 3 May 2003 17:52:24 -0000 1.7
--- SourceBasedTestBase.h 15 May 2003 16:29:12 -0000 1.8
***************
*** 11,14 ****
--- 11,17 ----
#include <rfta/parser/SourceASTNode.h>
#include <rfta/test/SourceBuilder.h>
+ #include <rfta/parser/ParseContext.h>
+ #include <rfta/parser/MaxLODMutator.h>
+ #include <rfta/parser/NonSemanticBlanker.h>
namespace Refactoring
***************
*** 31,37 ****
void tearDown();
! protected:
! void parse();
! void blankAndParse();
ASTNodePtr getIdentifierNode( const SourceRange &range );
ASTNodePtr getIdentifierNode( const std::string &identifierRangeKey );
--- 34,38 ----
void tearDown();
! protected:
ASTNodePtr getIdentifierNode( const SourceRange &range );
ASTNodePtr getIdentifierNode( const std::string &identifierRangeKey );
***************
*** 41,44 ****
--- 42,80 ----
SourceASTNodePtr sourceNode_;
boost::shared_ptr<Testing::SourceBuilder> builder_;
+
+ template < class ParserType >
+ void parse(ParserType*)
+ {
+ sourceNode_ = SourceASTNode::create( source_, source_ );
+ ParseContext context( sourceNode_ );
+ ParserType parser( context,
+ sourceNode_->getBlankedSourceStart(),
+ sourceNode_->getBlankedSourceEnd() );
+ CPPUNIT_ASSERT( parser.tryParse() );
+
+ // don't bother with lazy parsing for now...
+ MaxLODMutator mutator;
+ mutator.mutate( sourceNode_, sourceNode_ );
+ }
+
+ template < class ParserType >
+ void blankAndParse(ParserType*)
+ {
+ std::string blankedSource;
+ NullPPDirectiveListener nullListener;
+ NonSemanticBlanker blanker( source_, blankedSource, nullListener );
+ blanker.blank();
+
+ sourceNode_ = SourceASTNode::create( blankedSource, source_ );
+ ParseContext context( sourceNode_ );
+ ParserType parser( context,
+ sourceNode_->getBlankedSourceStart(),
+ sourceNode_->getBlankedSourceEnd() );
+ CPPUNIT_ASSERT( parser.tryParse() );
+
+ // don't bother with lazy parsing for now...
+ MaxLODMutator mutator;
+ mutator.mutate( sourceNode_, sourceNode_ );
+ }
};
Index: SourceBasedTestBase.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SourceBasedTestBase.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SourceBasedTestBase.cpp 6 Mar 2003 22:18:41 -0000 1.8
--- SourceBasedTestBase.cpp 15 May 2003 16:29:12 -0000 1.9
***************
*** 8,15 ****
#include <rfta/refactoring/ToolsBox.h>
#include <rfta/parser/ASTNodes.h>
- #include <rfta/parser/MaxLODMutator.h>
- #include <rfta/parser/NonSemanticBlanker.h>
- #include <rfta/parser/ParseContext.h>
- #include <rfta/parser/StatementsParser.h>
--- 8,11 ----
***************
*** 21,25 ****
}
-
SourceBasedTestBase::~SourceBasedTestBase()
{
--- 17,20 ----
***************
*** 45,48 ****
--- 40,44 ----
+ /*
void
SourceBasedTestBase::parse()
***************
*** 59,64 ****
mutator.mutate( sourceNode_, sourceNode_ );
}
!
void
SourceBasedTestBase::blankAndParse()
--- 55,61 ----
mutator.mutate( sourceNode_, sourceNode_ );
}
+ */
! /*
void
SourceBasedTestBase::blankAndParse()
***************
*** 80,83 ****
--- 77,81 ----
mutator.mutate( sourceNode_, sourceNode_ );
}
+ */
Index: IdentifierVisitorTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierVisitorTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IdentifierVisitorTest.cpp 20 Dec 2002 19:38:03 -0000 1.2
--- IdentifierVisitorTest.cpp 15 May 2003 16:29:12 -0000 1.3
***************
*** 6,10 ****
#include "stdafx.h"
#include "IdentifierVisitorTest.h"
!
namespace Refactoring
--- 6,10 ----
#include "stdafx.h"
#include "IdentifierVisitorTest.h"
! #include <rfta/Parser/StatementsParser.h>
namespace Refactoring
***************
*** 50,54 ****
IdentifierVisitorTest::visitAndVerifyExpectations()
{
! parse();
visitNode( sourceNode_ );
verify();
--- 50,54 ----
IdentifierVisitorTest::visitAndVerifyExpectations()
{
! parse((StatementsParser*)0);
visitNode( sourceNode_ );
verify();
Index: IdentifierResolverTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverTest.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** IdentifierResolverTest.cpp 5 Apr 2003 12:13:00 -0000 1.6
--- IdentifierResolverTest.cpp 15 May 2003 16:29:13 -0000 1.7
***************
*** 6,10 ****
#include "stdafx.h"
#include "IdentifierResolverTest.h"
!
namespace Refactoring
--- 6,10 ----
#include "stdafx.h"
#include "IdentifierResolverTest.h"
! #include <rfta/Parser/StatementsParser.h>
namespace Refactoring
***************
*** 54,58 ****
builder_->addKeyingMid( "", "y", " );", "y.1" );
! parse();
strategy_->setRecordMode();
strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "x.1" ) );
--- 54,58 ----
builder_->addKeyingMid( "", "y", " );", "y.1" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->resolveUnqualifiedIdentifier( getIdentifierNode( "x.1" ) );
***************
*** 72,76 ****
builder_->addKeyingMid( "double ", "z", " = 3.14;", "z.0" );
! parse();
strategy_->setRecordMode();
strategy_->declareLocalVariable( getVariableNode( "x.0" ) );
--- 72,76 ----
builder_->addKeyingMid( "double ", "z", " = 3.14;", "z.0" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->declareLocalVariable( getVariableNode( "x.0" ) );
***************
*** 89,93 ****
builder_->addKeyingMid( "", "x", ";", "x.1" );
! parse();
strategy_->setRecordMode();
strategy_->declareLocalVariable( getVariableNode( "x.0" ) );
--- 89,93 ----
builder_->addKeyingMid( "", "x", ";", "x.1" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->declareLocalVariable( getVariableNode( "x.0" ) );
***************
*** 108,112 ****
builder_->add( "}" );
! parse();
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
--- 108,112 ----
builder_->add( "}" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
***************
*** 126,130 ****
builder_->addKeyingMid( " int ", "y", " = 4;", "y.0" );
! parse();
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
--- 126,130 ----
builder_->addKeyingMid( " int ", "y", " = 4;", "y.0" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
***************
*** 149,153 ****
builder_->addKeyingMid( " int ", "z", " = 1;", "z.0" );
! parse();
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
--- 149,153 ----
builder_->addKeyingMid( " int ", "z", " = 1;", "z.0" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
***************
*** 174,178 ****
builder_->addKeyingMid( " int ", "y", " = 4;", "y.0" );
! parse();
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
--- 174,178 ----
builder_->addKeyingMid( " int ", "y", " = 4;", "y.0" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
***************
*** 197,201 ****
builder_->addKeyingMid( " int ", "x", " = 2;", "x.0" );
! parse();
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
--- 197,201 ----
builder_->addKeyingMid( " int ", "x", " = 2;", "x.0" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
***************
*** 224,228 ****
builder_->add( "}" );
! parse();
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
--- 224,228 ----
builder_->add( "}" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->enterNewLocalVariableScope();
***************
*** 264,268 ****
builder_->add( "}" );
! parse();
strategy_->setRecordMode();
strategy_->declareLocalVariable( getVariableNode( "bigBuffer.0" ) );
--- 264,268 ----
builder_->add( "}" );
! parse((StatementsParser*)0);
strategy_->setRecordMode();
strategy_->declareLocalVariable( getVariableNode( "bigBuffer.0" ) );
Index: IdentifierResolverContextTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierResolverContextTest.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** IdentifierResolverContextTest.cpp 10 May 2003 10:55:14 -0000 1.5
--- IdentifierResolverContextTest.cpp 15 May 2003 16:29:13 -0000 1.6
***************
*** 6,10 ****
#include "stdafx.h"
#include "IdentifierResolverContextTest.h"
!
namespace Refactoring
--- 6,10 ----
#include "stdafx.h"
#include "IdentifierResolverContextTest.h"
! #include <rfta/parser/StatementsParser.h>
namespace Refactoring
***************
*** 38,46 ****
}
-
void
IdentifierResolverContextTest::initializeResolver()
! {
! parse();
context_.reset( new IdentifierResolverContext() );
}
--- 38,45 ----
}
void
IdentifierResolverContextTest::initializeResolver()
! {
! parse((StatementsParser *)0);
context_.reset( new IdentifierResolverContext() );
}
Index: CodeWriterTestBase.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTestBase.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CodeWriterTestBase.cpp 6 Apr 2003 18:06:59 -0000 1.7
--- CodeWriterTestBase.cpp 15 May 2003 16:29:13 -0000 1.8
***************
*** 7,11 ****
#include "CodeWriterTestBase.h"
#include <rfta/refactoring/CodeModel.h>
!
namespace Refactoring
--- 7,11 ----
#include "CodeWriterTestBase.h"
#include <rfta/refactoring/CodeModel.h>
! #include <rfta/Parser/StatementsParser.h>
namespace Refactoring
***************
*** 35,39 ****
CodeWriterTestBase::generateCompound()
{
! blankAndParse();
ASTNodePtr compoundNode = sourceNode_->getChildAt(0);
--- 35,39 ----
CodeWriterTestBase::generateCompound()
{
! blankAndParse((StatementsParser*)0);
ASTNodePtr compoundNode = sourceNode_->getChildAt(0);
Index: CodeModelGeneratorTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeModelGeneratorTest.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** CodeModelGeneratorTest.cpp 21 Apr 2003 03:08:54 -0000 1.8
--- CodeModelGeneratorTest.cpp 15 May 2003 16:29:13 -0000 1.9
***************
*** 9,12 ****
--- 9,13 ----
#include <rfta/refactoring/CodeModelStatements.h>
#include <rfta/refactoring/CodeModelExpressions.h>
+ #include <rfta/Parser/StatementsParser.h>
***************
*** 44,48 ****
source_ = "int x = 3;";
! parse();
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
--- 45,49 ----
source_ = "int x = 3;";
! parse((StatementsParser*)0);
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
***************
*** 75,79 ****
source_ = "const int *x = NULL;";
! parse();
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
--- 76,80 ----
source_ = "const int *x = NULL;";
! parse((StatementsParser*)0);
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
***************
*** 103,107 ****
source_ = "int *x = NULL, **y=&x, *const z;";
! parse();
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
--- 104,108 ----
source_ = "int *x = NULL, **y=&x, *const z;";
! parse((StatementsParser*)0);
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
***************
*** 163,167 ****
source_ = "int (*f)(int);";
! parse();
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
--- 164,168 ----
source_ = "int (*f)(int);";
! parse((StatementsParser*)0);
RFTA_ASSERT_EQUAL( 1, sourceNode_->getChildCount() );
|