1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fix for failing unit tests

This commit is contained in:
Emanuel Graf 2010-03-18 13:51:42 +00:00
parent 0563296668
commit d9629c20b0
3 changed files with 18 additions and 14 deletions

View file

@ -181,7 +181,6 @@ public class ChangeGenerator extends CPPASTVisitor {
fileLocation = node.getTranslationUnit().flattenLocationsToFile(node.getNodeLocations());
}
}
return fileLocation;
}
@ -259,8 +258,13 @@ public class ChangeGenerator extends CPPASTVisitor {
newNodeCode));
break;
case APPEND_CHILD:
if(modification.getTargetNode() instanceof IASTTranslationUnit && ((IASTTranslationUnit)modification.getTargetNode()).getDeclarations().length > 0) {
IASTTranslationUnit tu = (IASTTranslationUnit)modification.getTargetNode();
IASTDeclaration lastDecl = tu.getDeclarations()[tu.getDeclarations().length -1];
targetLocation = lastDecl.getFileLocation();
}
String lineDelimiter = FileHelper.determineLineDelimiter(FileHelper.getIFilefromIASTNode(modification.getTargetNode()));
edit.addChild(new InsertEdit(targetLocation.getNodeOffset()
edit.addChild(new InsertEdit(targetLocation.getNodeOffset()
+ targetLocation.getNodeLength(),lineDelimiter + lineDelimiter + newNodeCode));
break;
}

View file

@ -127,12 +127,12 @@ class Demo
//=
#include "A.h"
void Demo::SubClass::test()
{
}
//!method declared in otherwise empty class without cpp file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@ -180,11 +180,11 @@ public:
//=
void A::test()
{
}
//!implement in existing namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@ -633,12 +633,12 @@ public:
//=
#include "A.h"
void Class::test(int param1, int param2, int param3)
{
}
//!static method
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@ -658,12 +658,12 @@ public:
//=
#include "A.h"
void Class::test()
{
}
//! Bug 238253 Pointer refence of the return value lost
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@ -682,12 +682,12 @@ public:
//=
#include "A.h"
int *TestClass::get(char *val)
{
}
//! Bug 238554 void parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@ -707,12 +707,12 @@ class Test
//=
#include "A.h"
void Test::doNothing(void)
{
}
//! Bug 282989 Refactor->Implement method option doesn't qualify the name in the method definition with a fully qualified container class name
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config

View file

@ -84,7 +84,7 @@ public class InsertLocation {
if(affectedNode != null) {
targetTranslationUnit = affectedNode.getTranslationUnit();
} else if(hasFile()) {
targetTranslationUnit = TranslationUnitHelper.loadTranslationUnit(insertFile, false);
targetTranslationUnit = TranslationUnitHelper.loadTranslationUnit(insertFile, true);
}
}