Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv984/src/rfta
Modified Files:
IdentifierScopeTest.h IdentifierScopeTest.cpp
Log Message:
-- test for qualified identifier lookup added
Index: IdentifierScopeTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierScopeTest.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IdentifierScopeTest.h 15 May 2003 16:25:40 -0000 1.1
--- IdentifierScopeTest.h 6 Sep 2003 21:48:55 -0000 1.2
***************
*** 6,11 ****
#define RFTA_IDENTIFIERSCOPETEST_H
- #include "IdentifierScope.h"
#include "UnitTesting.h"
namespace Refactoring
--- 6,11 ----
#define RFTA_IDENTIFIERSCOPETEST_H
#include "UnitTesting.h"
+ #include "IdentifierScope.h"
namespace Refactoring
***************
*** 18,21 ****
--- 18,22 ----
CPPUNIT_TEST_SUITE( IdentifierScopeTest );
CPPUNIT_TEST( testIdentifierResolutionInOneScope );
+ CPPUNIT_TEST( testQualifiedScopeLookup );
CPPUNIT_TEST_SUITE_END();
***************
*** 32,35 ****
--- 33,37 ----
void testIdentifierResolutionInOneScope();
+ void testQualifiedScopeLookup();
};
Index: IdentifierScopeTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IdentifierScopeTest.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IdentifierScopeTest.cpp 15 May 2003 16:25:40 -0000 1.1
--- IdentifierScopeTest.cpp 6 Sep 2003 21:48:55 -0000 1.2
***************
*** 81,85 ****
--- 81,96 ----
}
+ void
+ IdentifierScopeTest::testQualifiedScopeLookup()
+ {
+ IdentifierScopePtr rootScope = IdentifierScope::createScope(IdentifierScopeWeakPtr());
+ IdentifierScopePtr scopeA = IdentifierScope::createSubScope(rootScope,"A"); // "::A"
+ IdentifierScopePtr scopeB = IdentifierScope::createSubScope(scopeA ,"B"); // "::A::B"
+ IdentifierScopePtr scopeC = IdentifierScope::createSubScope(rootScope,"C"); // "::C"
+ IdentifierScopePtr scopeD = IdentifierScope::createSubScope(scopeB ,"D"); // "::A::B::D"
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Expected a different scope pointer.", scopeD, scopeC->getQualifiedScope("A::B::D") );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Expected a different scope pointer.", scopeC, scopeD->getQualifiedScope("::C") );
+ }
} // namespace Refactoring
|