1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +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()); fileLocation = node.getTranslationUnit().flattenLocationsToFile(node.getNodeLocations());
} }
} }
return fileLocation; return fileLocation;
} }
@ -259,6 +258,11 @@ public class ChangeGenerator extends CPPASTVisitor {
newNodeCode)); newNodeCode));
break; break;
case APPEND_CHILD: 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())); 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)); + targetLocation.getNodeLength(),lineDelimiter + lineDelimiter + newNodeCode));

View file

@ -127,12 +127,12 @@ class Demo
//= //=
#include "A.h" #include "A.h"
void Demo::SubClass::test() void Demo::SubClass::test()
{ {
} }
//!method declared in otherwise empty class without cpp file //!method declared in otherwise empty class without cpp file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config //@.config
@ -180,11 +180,11 @@ public:
//= //=
void A::test() void A::test()
{ {
} }
//!implement in existing namespace //!implement in existing namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config //@.config
@ -633,12 +633,12 @@ public:
//= //=
#include "A.h" #include "A.h"
void Class::test(int param1, int param2, int param3) void Class::test(int param1, int param2, int param3)
{ {
} }
//!static method //!static method
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config //@.config
@ -658,12 +658,12 @@ public:
//= //=
#include "A.h" #include "A.h"
void Class::test() void Class::test()
{ {
} }
//! Bug 238253 Pointer refence of the return value lost //! Bug 238253 Pointer refence of the return value lost
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config //@.config
@ -682,12 +682,12 @@ public:
//= //=
#include "A.h" #include "A.h"
int *TestClass::get(char *val) int *TestClass::get(char *val)
{ {
} }
//! Bug 238554 void parameters //! Bug 238554 void parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest //#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config //@.config
@ -707,12 +707,12 @@ class Test
//= //=
#include "A.h" #include "A.h"
void Test::doNothing(void) 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 //! 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 //#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config //@.config

View file

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