diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java
index 5cf34223998..a7c9580bec8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java
@@ -395,7 +395,8 @@ public class StatementWriter extends NodeWriter {
protected IASTStatement[] getNestedStatements(IASTCompoundStatement compoundStatement) {
return compoundStatement.getStatements();
}
-
+
+ // TODO(sprigogin): Rename second parameter
protected void writeBodyStatement(IASTStatement statement, boolean isDoStatement) {
if (statement instanceof IASTCompoundStatement) {
//TODO hsr existiert noch eine methode
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
index eb35b998fbd..f8a07a9b3e1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
@@ -590,6 +590,10 @@ public class ChangeGenerator extends ASTVisitor {
}
}
newNode.accept(writer);
+ // TODO(sprigogin): Temporary workaround for invalid handling of line breaks in StatementWriter
+ if (!writer.toString().endsWith("\n")) //$NON-NLS-1$
+ writer.newLine();
+
}
if (prevNode != null) {
IASTNode nextNode = getNextSiblingOrPreprocessorNode(prevNode);
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts
deleted file mode 100644
index 8099b078d57..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts
+++ /dev/null
@@ -1,518 +0,0 @@
-//!ExtractConstantInt
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- void bar();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- void bar();
-
- static const int theAnswer = 42;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return /*$*/42/*$$*/; //Hello
-}
-
-void A::bar() {
- int a = 42;
- int b = 42;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return theAnswer; //Hello
-}
-
-void A::bar() {
- int a = theAnswer;
- int b = theAnswer;
-}
-//!ExtractConstantInt 2
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- void bar();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- void bar();
-
- static const int theAnswer = 42;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- //Hallo
- return /*$*/42/*$$*/;
-}
-
-void A::bar() {
- int a = 42;
- int b = 42;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- //Hallo
- return theAnswer;
-}
-
-void A::bar() {
- int a = theAnswer;
- int b = theAnswer;
-}
-//!ExtractConstantFloat
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- float foo();
- void bar();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- float foo();
- void bar();
-
- static const float theAnswer = 42.0f;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-float A::foo() {
- return /*$*/42.0f/*$$*/;
-}
-
-void A::bar() {
- float a = 42.0f;
- float b = 42.0f;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-float A::foo() {
- return theAnswer;
-}
-
-void A::bar() {
- float a = theAnswer;
- float b = theAnswer;
-}
-//!ExtractConstantDouble
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- double foo();
- void bar();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- double foo();
- void bar();
-
- static const double theAnswer = 42.0;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-double A::foo() {
- return /*$*/42.0/*$$*/;
-}
-
-void A::bar() {
- double a = 42.0;
- double b = 42.0;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-double A::foo() {
- return theAnswer;
-}
-
-void A::bar() {
- double a = theAnswer;
- double b = theAnswer;
-}
-//!ExtractConstantStaticInt
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- static const int a = 42;
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- static const int a = 42;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return 42;
-}
-
-int bar() {
- return /*$*/42/*$$*/;
-}
-//=
-#include "A.h"
-
-namespace {
-
-const int theAnswer = 42;
-
-}
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return theAnswer;
-}
-
-int bar() {
- return theAnswer;
-}
-//!replaceNumberProtected
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@.config
-visibility=protected
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-};
-
-#endif /*A_H_*/
-
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-
-protected:
- static const int theAnswer = 42;
-};
-
-#endif /*A_H_*/
-
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return /*$*/42/*$$*/;
-}
-
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return theAnswer;
-}
-
-//!replaceNumberPrivate
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@.config
-visibility=private
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-
-private:
- static const int theAnswer = 42;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return /*$*/42/*$$*/;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return theAnswer;
-}
-//!Bug 246062 - Extracting a constant from an inlined method
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class X {
- void method() {
- int a = /*$*/42/*$$*/;
- }
-};
-//=
-class X {
-public:
- static const int theAnswer = 42;
-
-private:
- void method() {
- int a = theAnswer;
- }
-};
-//!Extract constant string
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@.config
-visibility=private
-filename=A.h
-//@A.h
-class X {
- void method() {
- char* a = /*$*/"sometext"/*$$*/;
- }
-
- void method2() {
- const char* b = "sometext";
- }
-};
-
-//=
-class X {
- void method() {
- char* a = theAnswer;
- }
-
- void method2() {
- const char* b = theAnswer;
- }
-
- static const char* theAnswer = "sometext";
-};
-
-//!ExtractConstantWideString
-//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
-//@.config
-visibility=private
-filename=A.h
-//@A.h
-class X {
- void method() {
- wchar_t* a = /*$*/L"sometext"/*$$*/;
- }
-
- void method2() {
- const wchar_t* b = L"sometext";
- const char* c = "sometext";
- }
-};
-
-//=
-class X {
- void method() {
- wchar_t* a = theAnswer;
- }
-
- void method2() {
- const wchar_t* b = theAnswer;
- const char* c = "sometext";
- }
-
- static const wchar_t* theAnswer = L"sometext";
-};
-
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts
deleted file mode 100644
index 6df4814549a..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts
+++ /dev/null
@@ -1,197 +0,0 @@
-//!ExtractConstantInt
-//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- void bar();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
- void bar();
-
- static const int theAnswer = 42;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return 42; // Hello
-}
-
-void A::bar() {
- int a = 42;
- int b = 42;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return theAnswer; // Hello
-}
-
-void A::bar() {
- int a = theAnswer;
- int b = theAnswer;
-}
-//@refScript.xml
-
-
-
-
-
-
-//!replaceNumberProtected
-//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-
-protected:
- static const int theAnswer = 42;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return 42;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return theAnswer;
-}
-//@refScript.xml
-
-
-
-
-
-//!replaceNumberPrivate
-//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-};
-
-#endif /*A_H_*/
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- A();
- virtual ~A();
- int foo();
-
-private:
- static const int theAnswer = 42;
-};
-
-#endif /*A_H_*/
-//@A.cpp
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return 42;
-}
-//=
-#include "A.h"
-
-A::A() {
-}
-
-A::~A() {
-}
-
-int A::foo() {
- return theAnswer;
-}
-//@refScript.xml
-
-
-
-
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts
deleted file mode 100644
index ac0dfa784c4..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts
+++ /dev/null
@@ -1,1512 +0,0 @@
-//!Generate Getters and Setters One Getter Selection
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=name
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-
- char* getName() const {
- return name;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-//!Generate Getters and Setters One Getter Selection with Namespace
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=name
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-namespace Personal {
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-}
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-namespace Personal {
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-
- char* getName() const {
- return name;
- }
-};
-
-}
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-//!Generate Getters and Setters One Setter Selection
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-setters=name
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-
- void setName(char* name) {
- this->name = name;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-//!Generate Getters and Setters Getter and Setter Selection
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-setters=name
-getters=name
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-
- char* getName() const {
- return name;
- }
-
- void setName(char* name) {
- this->name = name;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-//!Generate Getters and Setters Multiple Selection
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=name,systemId
-setters=name,systemId
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- char* getName() const {
- return name;
- }
-
- void setName(char* name) {
- this->name = name;
- }
-
- int getSystemId() const {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-//!Generate Getters and Setters Visibility order 1
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=GaS.h
-getters=i,ok
-setters=i,ok
-//@GaS.h
-#ifndef GAS_H_
-#define GAS_H_
-
-class GaS {
-public:
- GaS();
- virtual ~GaS();
- bool /*$*/ok/*$$*/;
- void method2();
-
-private:
- int i;
-};
-
-#endif
-//=
-#ifndef GAS_H_
-#define GAS_H_
-
-class GaS {
-public:
- GaS();
- virtual ~GaS();
- bool ok;
- void method2();
-
- int getI() const {
- return i;
- }
-
- void setI(int i) {
- this->i = i;
- }
-
- bool isOk() const {
- return ok;
- }
-
- void setOk(bool ok) {
- this->ok = ok;
- }
-
-private:
- int i;
-};
-
-#endif
-//@GaS.cpp
-#include "Getters.h"
-
-GaS::Getters() {
-}
-
-GaS::~Getters() {
-}
-//!Generate Getters and Setters no methods
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=id
-setters=id
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int /*$*/id/*$$*/;
-};
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-public:
- int getId() const {
- return id;
- }
-
- void setId(int id) {
- this->id = id;
- }
-
-private:
- int id;
-};
-
-#endif /* A_H_ */
-//!Generate Getters and Setters no methods ascending visibility order
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=i
-setters=i
-ascendingVisibilityOrder=true
-//@A.h
-/*
- * test.h
- */
-
-#ifndef TEST_H_
-#define TEST_H_
-
-//comment1
-class test {
- int /*$*/i/*$$*/; //comment2
- char* b;
- //comment3
-};
-
-#endif /* TEST_H_ */
-//=
-/*
- * test.h
- */
-
-#ifndef TEST_H_
-#define TEST_H_
-
-//comment1
-class test {
- int i; //comment2
- char* b;
- //comment3
-
-public:
- int getI() const {
- return i;
- }
-
- void setI(int i) {
- this->i = i;
- }
-};
-
-#endif /* TEST_H_ */
-//!Generate Getters and Setters no fields
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-fatalerror=true
-//@A.h
-/*
- * test.h
- */
-
-#ifndef TEST_H_
-#define TEST_H_
-
-//comment1
-class test {
- void /*$*/test/*$$*/();
- //comment3
-};
-
-#endif /* TEST_H_ */
-//=
-/*
- * test.h
- */
-
-#ifndef TEST_H_
-#define TEST_H_
-
-//comment1
-class test {
- void test();
- //comment3
-};
-
-#endif /* TEST_H_ */
-//!Generate Getters and Setters, Pass by Reference, Separate Definition
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=name
-setters=name
-definitionSeparate=true
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-struct FullName {
- const char* first;
- const char* last;
- FullName(const FullName& other);
- ~FullName();
-};
-
-class Person {
-private:
- int systemId;
-
-protected:
- FullName name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId();
-
- void setSystemId(int systemId);
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-struct FullName {
- const char* first;
- const char* last;
- FullName(const FullName& other);
- ~FullName();
-};
-
-class Person {
-private:
- int systemId;
-
-protected:
- FullName name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId();
-
- void setSystemId(int systemId);
- const FullName& getName() const;
- void setName(const FullName& name);
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-#include "A.h"
-
-const FullName& Person::getName() const {
- return name;
-}
-
-void Person::setName(const FullName& name) {
- this->name = name;
-}
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//!Generate Getters and Setters One Getter Selection with Namespace Separate Definition
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=name
-definitionSeparate=true
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-namespace Personal {
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-}
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-namespace Personal {
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-
- char* getName() const;
-};
-
-}
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-namespace Personal {
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-} // namespace Personal
-
-int main(int argc, char** argv) {
-}
-//=
-#include "A.h"
-
-namespace Personal {
-
-char* Person::getName() const {
- return name;
-}
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-} // namespace Personal
-
-int main(int argc, char** argv) {
-}
-//!Generate Getters and Setters One Setter Selection Separate Definition
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-setters=name
-definitionSeparate=true
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-
- void setName(char* name);
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-#include "A.h"
-
-void Person::setName(char* name) {
- this->name = name;
-}
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//!Getter and Setter Selection Separate Definition
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-setters=name
-getters=name
-definitionSeparate=true
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int systemId;
-
-protected:
- char* name;
-
-public:
- const int socSecNo;
-
- Person myFriend;
-
- Person(int socSecNo); // constructor
-
- ~Person(); // destructor
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
- int getSystemId() {
- return systemId;
- }
-
- void setSystemId(int systemId) {
- this->systemId = systemId;
- }
-
- char* getName() const;
- void setName(char* name);
-};
-
-int gooo = 1;
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//=
-#include "A.h"
-
-char* Person::getName() const {
- return name;
-}
-
-void Person::setName(char* name) {
- this->name = name;
-}
-
-int Person::SocSecNo() {
- return socSecNo;
-}
-
-int main(int argc, char** argv) {
-}
-//!Generate Getters and Setters no Methods Separate Definition
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=id
-setters=id
-definitionSeparate=true
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class Person {
-private:
- int /*$*/id/*$$*/;
-};
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class Person {
-public:
- int getId() const;
- void setId(int id);
-
-private:
- int id;
-};
-
-inline int Person::getId() const {
- return id;
-}
-
-inline void Person::setId(int id) {
- this->id = id;
-}
-
-#endif /* A_H_ */
-//!No Methods Separate Definition
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=i
-setters=i
-definitionSeparate=true
-//@A.h
-/*
- * test.h
- */
-
-#ifndef TEST_H_
-#define TEST_H_
-
-//comment1
-class test {
- int /*$*/i/*$$*/; //comment2
- char* b;
- //comment3
-};
-
-#endif /* TEST_H_ */
-//=
-/*
- * test.h
- */
-
-#ifndef TEST_H_
-#define TEST_H_
-
-//comment1
-class test {
-public:
- int getI() const;
- void setI(int i);
-
-private:
- int i; //comment2
- char* b;
- //comment3
-};
-
-inline int test::getI() const {
- return i;
-}
-
-inline void test::setI(int i) {
- this->i = i;
-}
-
-#endif /* TEST_H_ */
-//!Bug 323780 "Generate Getters and Setters..." crashes
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=Test.h
-getters=testField
-setters=testField
-definitionSeparate=true
-
-//@Test.h
-#ifndef TEST_H_
-#define TEST_H_
-
-namespace foo {
-
-class Test {
- int /*$*/testField/*$$*/;
- void foo();
-};
-
-} // namespace foo
-
-#endif
-//=
-#ifndef TEST_H_
-#define TEST_H_
-
-namespace foo {
-
-class Test {
-public:
- int getTestField() const;
- void setTestField(int testField);
-
-private:
- int testField;
- void foo();
-};
-
-} // namespace foo
-
-#endif
-//@Test.cpp
-#include "Test.h"
-
-namespace foo {
-
-void Test::foo() {
-}
-
-}
-//=
-#include "Test.h"
-
-namespace foo {
-
-int Test::getTestField() const {
- return testField;
-}
-
-void Test::setTestField(int testField) {
- this->testField = testField;
-}
-
-void Test::foo() {
-}
-
-}
-//!Bug 337040 - Insert definition in empty implementation file (.cxx)
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=Test.h
-getters=testField
-setters=testField
-definitionSeparate=true
-
-//@Test.h
-#ifndef TEST_H_
-#define TEST_H_
-
-class Test {
- int /*$*/testField/*$$*/;
-};
-
-#endif
-//=
-#ifndef TEST_H_
-#define TEST_H_
-
-class Test {
-public:
- int getTestField() const;
- void setTestField(int testField);
-
-private:
- int testField;
-};
-
-#endif
-//@Test.cxx
-
-//=
-int Test::getTestField() const {
- return testField;
-}
-
-void Test::setTestField(int testField) {
- this->testField = testField;
-}
-//!Bug 337040 - Insert definition in empty implementation file in complex directory structure
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=component_b/public_headers/Test.h
-getters=testField
-setters=testField
-definitionSeparate=true
-
-//@component_b/public_headers/Test.h
-#ifndef TEST_H_
-#define TEST_H_
-
-class Test {
- int /*$*/testField/*$$*/;
-};
-
-#endif
-//=
-#ifndef TEST_H_
-#define TEST_H_
-
-class Test {
-public:
- int getTestField() const;
- void setTestField(int testField);
-
-private:
- int testField;
-};
-
-#endif
-//@component_b/implementation/Test.cpp
-
-//=
-int Test::getTestField() const {
- return testField;
-}
-
-void Test::setTestField(int testField) {
- this->testField = testField;
-}
-//@component_a/public_headers/Test.h
-
-//=
-
-//@component_a/implementation/Test.cpp
-
-//=
-
-//!Bug 363244 - Generate Getters and Setters for class with macro
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=test
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-#define Typedef \
- typedef int Int
-
-class Test
-{
-public:
- Typedef;
-
- void Foo();
- Test();
-
- int /*$*/test/*$$*/;
-};
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-#define Typedef \
- typedef int Int
-
-class Test
-{
-public:
- Typedef;
-
- void Foo();
- Test();
-
- int getTest() const {
- return test;
- }
-
- int test;
-};
-#endif /* A_H_ */
-//!Bug 319278 - Getter for an array field
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=a
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class A {
-private:
- int /*$*/a[2]/*$$*/;
-};
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class A {
-public:
- const int* getA() const {
- return a;
- }
-
-private:
- int a[2];
-};
-#endif /* A_H_ */
-//!Bug 352258 - Avoiding reserved names
-//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
-//@.config
-filename=A.h
-getters=mClass
-setters=mClass
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-class getClass {
-private:
- int /*$*/mClass/*$$*/;
-};
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-class getClass {
-public:
- int getClass1() const {
- return mClass;
- }
-
- void setClass(int clazz) {
- mClass = clazz;
- }
-
-private:
- int mClass;
-};
-#endif /* A_H_ */
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts
index 9329f5d7ded..31440b3d883 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts
@@ -1361,7 +1361,7 @@ private:
//#org.eclipse.cdt.ui.tests.refactoring.hidemethod.HideMethodRefactoringTest
//@.config
filename=A.cpp
-fatalerrors=1
+fatalerror=true
//@A.cpp
int /*$*/main/*$$*/() {
int i = 2;
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts
deleted file mode 100644
index 4ac721ac2a1..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts
+++ /dev/null
@@ -1,44 +0,0 @@
-//!FreeFunctionFromHeaderToImpl
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-newfilecreation=true
-newfiles=A.cpp
-//@A.h
-void /*$*/freefunction/*$$*/() {
- return;
-}
-//=
-void freefunction();
-
-//@A.cpp
-//=
-
-
-#include "A.h"
-
-void freefunction() {
- return;
-}
-//!FreeFunctionFromImplToHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-newfilecreation=true
-newfiles=A.h
-//@A.cpp
-void /*$*/freefunction/*$$*/() {
- return;
-}
-//=
-#include "A.h"
-
-
-//@A.h
-//=
-
-
-void freefunction() {
- return;
-}
-
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts
deleted file mode 100644
index f84ae165492..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts
+++ /dev/null
@@ -1,186 +0,0 @@
-//!ClassToHeaderBodyComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void /*$*/member/*$$*/() {
- // return comment
- return;
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- // return comment
- return;
-}
-//!ClassToHeaderTopCommentOrder
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- // First Top Comment
- // Second Top Comment
- void /*$*/member/*$$*/() {
- return;
- }
-};
-//=
-class A {
- // First Top Comment
- // Second Top Comment
- void member();
-};
-
-inline void A::member() {
- return;
-}
-//!ClassToHeaderCatchComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void /*$*/member/*$$*/() try
- {
- return;
- }
- catch (int i) {
- // catch comment
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member()
-try {
- return;
-}
-catch (int i) {
- // catch comment
-}
-//!ClassToHeaderTopComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- // Top comment
- void /*$*/member/*$$*/() {
- return;
- }
-};
-//=
-class A {
- // Top comment
- void member();
-};
-
-inline void A::member() {
- return;
-}
-//!ClassToHeaderTemplateTopComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- // Top comment
- template
- T /*$*/member/*$$*/() {
- return T();
- }
-};
-//=
-class A {
- // Top comment
- template
- T member();
-};
-
-// Top comment
-template
-inline T A::member() {
- return T();
-}
-//!ClassToHeaderTrailingComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void /*$*/member/*$$*/() {
- return;
- } // Trailing comment
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- return;
-} // Trailing comment
-//!ClassToHeaderTrailingCommentWithTryBlock
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void /*$*/member/*$$*/()
- try {
- return;
- }
- catch (int e) {
- } // Trailing comment
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member()
-try {
- return;
-}
-catch (int e) {
-}
-// Trailing comment
-//!ClassToHeaderTrailingMultipleCommentsInTryBlock
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- int /*$*/member/*$$*/()
- try {
- // aans
- } /* one */ catch (int i) {
- // zwaa
- } /* two */ catch (int j) {
- // draa
- } /* three */
-};
-//=
-class A {
- int member();
-};
-
-inline int A::member()
-try {
- // aans
-} /* one */
-catch (int i) {
- // zwaa
-}
-/* two */catch (int j) {
- // draa
-}
-/* three */
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts
deleted file mode 100644
index 70d269f1b47..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts
+++ /dev/null
@@ -1,141 +0,0 @@
-//!HeaderToClassBodyComment1
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-template
-class A {
- T /*$*/member/*$$*/();
-};
-
-template
-inline T A::member() {
- // body comment
- return T();
-}
-//=
-template
-class A {
- T member() {
- // body comment
- return T();
- }
-};
-//!HeaderToClassRetainTopComments
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-template
-class A {
- // First comment
- // Second comment
- T /*$*/member/*$$*/();
-};
-
-// Third comment
-// Fourth comment
-template
-inline T A::member() {
- return T();
-}
-//=
-template
-class A {
- // First comment
- // Second comment
- // Third comment
- // Fourth comment
- T member() {
- return T();
- }
-};
-//!HeaderToClassTryCatchComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-template
-class A {
- T /*$*/member/*$$*/();
-};
-
-template
-inline T A::member()
-try {
- // body comment
- return T();
-}
-catch (int e) {
- // Catch 1
-}
-catch (int e) {
- // Catch 2
-}
-//=
-template
-class A {
- T member()
- try {
- // body comment
- return T();
- }
- catch (int e) {
- // Catch 1
- }
- catch (int e) {
- // Catch 2
- }
-};
-//!HeaderToClassMultiTemplateComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-template
-class A {
- // Top Comment
- template
- T /*$*/member/*$$*/();
-};
-
-// 2nd Top Comment
-template
-template
-inline T A::member() {
- // body comment
- return T();
-}
-//=
-template
-class A {
- // Top Comment
- template
- T member() {
- // body comment
- return T();
- }
-};
-//!HeaderToClassBodyComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-template
-class A {
- T /*$*/member/*$$*/();
-};
-
-// Top comment
-template
-inline T A::member() {
- return T();
-}
-//=
-template
-class A {
- // Top comment
- T member() {
- return T();
- }
-};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts
deleted file mode 100644
index 95ac67e6d36..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts
+++ /dev/null
@@ -1,109 +0,0 @@
-//!HeaderToImplBodyComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void /*$*/member/*$$*/();
-};
-
-inline void A::member() {
- // body comment
- return;
-}
-//=
-class A {
- void member();
-};
-//@A.cpp
-#include "A.h"
-//=
-#include "A.h"
-
-void A::member() {
- // body comment
- return;
-}
-//!HeaderToImplTryCatchComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void /*$*/member/*$$*/();
-};
-
-inline void A::member() try {
- // body comment
- return;
-} catch /*1*/ (int e) { /*2*/ }
-catch /*3*/ (int e) { /*4*/ }
-//=
-class A {
- void member();
-};
-//@A.cpp
-#include "A.h"
-//=
-#include "A.h"
-
-void A::member()
-try {
- // body comment
- return;
-}
-catch (/*1*/int e) {
- /*2*/
-}
-catch (/*3*/int e) {
- /*4*/
-}
-//!HeaderToImplTopComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void /*$*/member/*$$*/();
-};
-
-// Top comment
-inline void A::member() {
- // body comment
- return;
-}
-//=
-class A {
- void member();
-};
-//@A.cpp
-#include "A.h"
-//=
-#include "A.h"
-
-// Top comment
-void A::member() {
- // body comment
- return;
-}
-//!HeaderToImplFreeFuncTopComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-// Definition comment
-void /*$*/member/*$$*/() {
- return;
-}
-//=
-// Definition comment
-void member();
-//@A.cpp
-#include "A.h"
-//=
-#include "A.h"
-
-// Definition comment
-void member() {
- return;
-}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts
deleted file mode 100644
index 64a295bb055..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts
+++ /dev/null
@@ -1,121 +0,0 @@
-//!ImplToHeaderBodyComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-void A::/*$*/member/*$$*/() {
- // body comment
- return;
-}
-//=
-#include "A.h"
-//@A.h
-class A {
- void member();
-};
-//=
-class A {
- void member() {
- // body comment
- return;
- }
-};
-//!ImplToHeaderTopComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-// Definition comment
-void A::/*$*/member/*$$*/() {
- return;
-}
-//=
-#include "A.h"
-//@A.h
-class A {
- void member();
-};
-//=
-class A {
- // Definition comment
- void member() {
- return;
- }
-};
-//!ImplToHeaderTryCatchComment
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-// Definition comment
-void A::/*$*/member/*$$*/() try {
- return;
-} /*1*/ catch (int e) { /*2*/ } /*3*/ catch (int e) { /*4*/ }
-//=
-#include "A.h"
-//@A.h
-class A {
- void member();
-};
-//=
-class A {
- // Definition comment
- void member()
- try {
- return;
- } /*1*/
- catch (int e) {
- /*2*/
- }
- /*3*/catch (int e) {
- /*4*/
- }
-};
-//!ImplToHeaderBodyCommentWithoutDeclaration
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-void /*$*/member/*$$*/() {
- // body comment
- return;
-}
-//=
-#include "A.h"
-//@A.h
-
-//=
-void member() {
- // body comment
- return;
-}
-//!ImplToHeaderTopCommentWithoutDeclaration
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-// Top comment
-void /*$*/member/*$$*/() {
- // body comment
- return;
-}
-//=
-#include "A.h"
-//@A.h
-
-//=
-// Top comment
-void member() {
- // body comment
- return;
-}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts
deleted file mode 100644
index f4832deaec6..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts
+++ /dev/null
@@ -1,242 +0,0 @@
-//!TestConstructorToggleInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- /*$*/A/*$$*/(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-//=
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y);
- ~A() {
- }
-};
-
-inline A::A(int x, int y) :
- a(x), b(y) {
-}
-//!TestConstructorToggleInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y);
- ~A() {
- }
-};
-
-inline A::/*$*/A/*$$*/(int x, int y) :
- a(x), b(y) {
-}
-//=
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y);
- ~A() {
- }
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-A::A(int x, int y) :
- a(x), b(y) {
-}
-//!TestConstructorToggleInImplementationToClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-A::/*$*/A/*$$*/(int x, int y) :
- a(x), b(y) {
-}
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
- A(int x, int y);
- ~A() {
- }
-};
-//=
-#include
-
-class A {
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-//!TestDestructorToggleInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- /*$*/~A/*$$*/() {
- }
-};
-//=
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- ~A();
-};
-
-inline A::~A() {
-}
-//!TestDestructorToggleInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- ~A();
-};
-
-inline /*$*/A::~A/*$$*/() {
-}
-//=
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- ~A();
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-A::~A() {
-}
-//!TestDestructorToggleInImplementationToClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-/*$*/A::~A/*$$*/() {
- int x;
- int y;
- return;
-}
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A();
-};
-//=
-#include
-
-class A {
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- int x;
- int y;
- return;
- }
-};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts
deleted file mode 100644
index 8c7d3b7c23a..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts
+++ /dev/null
@@ -1,92 +0,0 @@
-//!TestDefaultParameterInitializerInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
- void /*$*/member/*$$*/(int a = 0, int b = 0) {
- return;
- }
-};
-//=
-#include
-
-class A {
- void member(int a = 0, int b = 0);
-};
-
-inline void A::member(int a, int b) {
- return;
-}
-//!TestDefaultParameterInitializerInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
- void member(int a = 0, int b = 0);
-};
-
-inline void /*$*/A::member/*$$*/(int a, int b) {
- return;
-}
-//=
-#include
-
-class A {
- void member(int a = 0, int b = 0);
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void A::member(int a, int b) {
- return;
-}
-//!TestDefaultParameterInitializerInImplementationToClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-void A::/*$*/member/*$$*/(int a, int b) {
- return;
-}
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
- void member(int a = 0, int b = 0);
-};
-//=
-#include
-
-class A {
- void member(int a = 0, int b = 0) {
- return;
- }
-};
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts
deleted file mode 100644
index a08d9a0453a..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts
+++ /dev/null
@@ -1,90 +0,0 @@
-//!TestImplementationToClassWithDefintionSelected
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void N::A::/*$*/foo/*$$*/() {
- return;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-}
-//=
-#include
-#include
-
-namespace N {
-
-class A {
- void foo() {
- return;
- }
-};
-
-}
-//!TestImplementationToClassWithDeclarationSelected
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-namespace N {
-
-class A {
- void /*$*/foo/*$$*/();
-};
-
-}
-
-//=
-#include
-#include
-
-namespace N {
-
-class A {
- void foo() {
- return;
- }
-};
-
-}
-
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void N::A::foo() {
- return;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts
deleted file mode 100644
index 307f138e3ef..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts
+++ /dev/null
@@ -1,105 +0,0 @@
-//!TestNotSupportedVariableSelection
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-fatalerror=true
-//@A.h
-#include
-
-class A {
-public:
- void foo() {
- }
-
-private:
- int /*$*/x/*$$*/;
-};
-
-//!TestNotSupportedNoDefinition
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-fatalerror=true
-//@A.h
-#include
-
-class A {
-public:
- void /*$*/foo/*$$*/();
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-//!TestNotSupportedNoTranslationunit
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-fatalerror=true
-//@A.h
-#include
-
-class A {
-public:
- void /*$*/foo/*$$*/();
-};
-
-//!TestMultipleDeclarations
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-fatalerror=true
-//@A.h
-#include
-
-class A {
- void /*$*/foo/*$$*/();
- void foo();
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-//!TestMultipledefinitions
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-fatalerror=true
-//@A.h
-#include
-
-class A {
- void foo();
- void /*$*/foo/*$$*/() {
- return;
- }
-};
-
-void blah() {
-}
-
-inline void A::foo() {
- return;
-}
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-//!TestNotSupportedNestedFunctions
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-fatalerror=true
-//@A.h
-#include
-
-class A {
- void foo() {
- void /*$*/bar/*$$*/() {
- }
- }
-};
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts
deleted file mode 100644
index d17f1fb9365..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts
+++ /dev/null
@@ -1,260 +0,0 @@
-//!TestFreeFunctionToggleFromHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-
-int /*$*/freeFunction/*$$*/(int* a, int& b) {
- return 42;
-}
-//=
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-
-int freeFunction(int* a, int& b);
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-int freeFunction(int* a, int& b) {
- return 42;
-}
-//!TestFreeFunctionToggleFromImplementationToHeaderWithDeclaration
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-int /*$*/freeFunction/*$$*/(int* a, int& b) {
- return 42;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-
-int freeFunction(int* a, int& b);
-//=
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-
-int freeFunction(int* a, int& b) {
- return 42;
-}
-//!TestFreeFunctionToggleFromImplementationToHeaderWithOutDeclaration
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-int /*$*/freeFunction/*$$*/(int* a, int& b)
-try {
- return 42;
-}
-catch (std::exception& e) {
-}
-
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-//=
-#include
-
-class A {
-private:
- int a;
- int b;
-
-public:
- A(int x, int y) :
- a(x), b(y) {
- }
- ~A() {
- }
-};
-
-int freeFunction(int* a, int& b)
-try {
- return 42;
-}
-catch (std::exception& e) {
-}
-//!TestFreeFunction
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-int /*$*/freeFunction/*$$*/() {
- return 42;
-}
-//=
-int freeFunction();
-//@A.cpp
-#include "A.h"
-//=
-#include "A.h"
-
-int freeFunction() {
- return 42;
-}
-//!TestQualifiedNameToggle
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-fatalerror=true
-//@A.cpp
-#include "A.h"
-
-int /*$*/A::freefunction/*$$*/() {
- return 42;
-}
-//=
-#include "A.h"
-
-int A::freefunction() {
- return 42;
-}
-//!TestNamespacedFreeFunction
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#ifndef A_H_
-#define A_H_
-
-#include
-
-namespace N {
-
-void /*$*/freefunction/*$$*/() {
- return;
-}
-
-}
-
-#endif /* A_H_ */
-//=
-#ifndef A_H_
-#define A_H_
-
-#include
-
-namespace N {
-
-void freefunction();
-
-}
-
-#endif /* A_H_ */
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-namespace N {
-
-void freefunction() {
- return;
-}
-
-}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts
deleted file mode 100644
index ec4baa9d2ce..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts
+++ /dev/null
@@ -1,265 +0,0 @@
-//!Test simple namespace in class to in header
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-namespace N {
-
-class A {
- void /*$*/foo/*$$*/() {
- return;
- }
-};
-
-}
-//=
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-inline void A::foo() {
- return;
-}
-
-}
-//!Test simple namespace in header to implementation within namespace definition
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-inline void A::/*$*/foo/*$$*/() {
- return;
-}
-
-}
-//=
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-}
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-namespace N {
-
-void A::foo() {
- return;
-}
-
-}
-//!Test simple namespace in header to implementation with namespace definition in implementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-inline void A::/*$*/foo/*$$*/() {
- return;
-}
-
-}
-//=
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-}
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-namespace N {
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-namespace N {
-
-void A::foo() {
- return;
-}
-
-}
-//!Test simple namespace in header to implementation with namespace qualified name
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-}
-
-inline void /*$*/N::A::foo/*$$*/() {
- return;
-}
-//=
-#include
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-}
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-namespace N {
-
-void A::foo() {
- return;
-}
-
-}
-//!TestSimpleNamespaceFromImplementationToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-void /*$*/N::A::foo/*$$*/() {
- return;
-}
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-}
-//=
-#include
-
-namespace N {
-
-class A {
- void foo() {
- return;
- }
-};
-
-}
-//!TestRemoveEmptyNamespaceFromImplentation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-namespace N {
-
-void /*$*/A::foo/*$$*/() {
- return;
-}
-
-}
-//=
-#include "A.h"
-//@A.h
-#include
-
-namespace N {
-
-class A {
- void foo();
-};
-
-}
-//=
-#include
-
-namespace N {
-
-class A {
- void foo() {
- return;
- }
-};
-
-}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts
deleted file mode 100644
index c2e2372d430..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts
+++ /dev/null
@@ -1,104 +0,0 @@
-//!TestNestedClassInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
- class B {
- void /*$*/member/*$$*/(int a, int b) {
- return;
- }
- };
-};
-//=
-#include
-
-class A {
- class B {
- void member(int a, int b);
- };
-};
-
-inline void A::B::member(int a, int b) {
- return;
-}
-//!TestNestedClassInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
- class B {
- void member(int a, int b);
- };
-};
-
-inline void A::B::/*$*/member/*$$*/(int a, int b) {
- return;
-}
-//=
-#include
-
-class A {
- class B {
- void member(int a, int b);
- };
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void A::B::member(int a, int b) {
- return;
-}
-//!TestNestedClassInImplementationToClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void A::B::/*$*/member/*$$*/(int a, int b) {
- return;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
- class B {
- void member(int a, int b);
- };
-};
-//=
-#include
-
-class A {
- class B {
- void member(int a, int b) {
- return;
- }
- };
-};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts
deleted file mode 100644
index 2622b732712..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts
+++ /dev/null
@@ -1,202 +0,0 @@
-//!TestCorrectOrderingInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-public:
- void func1();
- void /*$*/func2/*$$*/() {
- }
- void func3();
- void func4() {
- }
-};
-
-inline void A::func1() {
-}
-
-inline void A::func3() {
-}
-//=
-#include
-
-class A {
-public:
- void func1();
- void func2();
- void func3();
- void func4() {
- }
-};
-
-inline void A::func1() {
-}
-
-inline void A::func2() {
-}
-
-inline void A::func3() {
-}
-//!TestCorrectOrderingInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-public:
- void func1();
- void func2();
- void func3();
- void func4() {
- }
-};
-
-inline void A::/*$*/func2/*$$*/() {
- return;
-}
-//=
-#include
-
-class A {
-public:
- void func1();
- void func2();
- void func3();
- void func4() {
- }
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void A::func1() {
- return;
-}
-
-void A::func3() {
- return;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void A::func1() {
- return;
-}
-
-void A::func2() {
- return;
-}
-
-void A::func3() {
- return;
-}
-//!TestCorrectTemplateOrderingInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-template
-class A {
-public:
- void func1();
- void /*$*/func2/*$$*/() {
- }
- void func3();
- void func4() {
- }
-};
-
-template
-inline void A::func1() {
-}
-
-template
-inline void A::func3() {
-}
-//=
-#include
-
-template
-class A {
-public:
- void func1();
- void func2();
- void func3();
- void func4() {
- }
-};
-
-template
-inline void A::func1() {
-}
-
-template
-inline void A::func2() {
-}
-
-template
-inline void A::func3() {
-}
-//!TestCorrectTemplateOrderingInHeaderToInClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-template
-class A {
-public:
- void func1();
- void func2();
- void func3();
- void func4() {
- }
-};
-
-template
-inline void A::func1() {
-}
-
-template
-inline void A::/*$*/func2/*$$*/() {
-}
-
-template
-inline void A::func3() {
-}
-//=
-#include
-
-template
-class A {
-public:
- void func1();
- void func2() {
- }
- void func3();
- void func4() {
- }
-};
-
-template
-inline void A::func1() {
-}
-
-template
-inline void A::func3() {
-}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts
deleted file mode 100644
index 0518f02bad3..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts
+++ /dev/null
@@ -1,128 +0,0 @@
-//!Test zero length selection
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void me/*$*//*$$*/mber() {
- return;
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- return;
-}
-//!Test substring selection
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void m/*$*/e/*$$*/mber() {
- return;
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- return;
-}
-//!Test body selection
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void member() {
- r/*$*//*$$*/eturn;
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- return;
-}
-//!Test body selection with confusing name
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void member() {
- int /*$*/abcd/*$$*/ = 42;
- return;
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- int abcd = 42;
- return;
-}
-//!Test left border selection
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- /*$*//*$$*/void member() {
- return;
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- return;
-}
-//!Test right border selection
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- void member() {
- return;
- }/*$*//*$$*/
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- return;
-}
-//!Test overlapping selection
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- vo/*$*/id member() {
- ret/*$$*/urn;
- }
-};
-//=
-class A {
- void member();
-};
-
-inline void A::member() {
- return;
-}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts
deleted file mode 100644
index b15bc2123c5..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts
+++ /dev/null
@@ -1,184 +0,0 @@
-//!Test simple function in class to in header
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-public:
- int /*$*/function/*$$*/() {
- return 0;
- }
-
-private:
- int a;
-};
-//=
-#include
-
-class A {
-public:
- int function();
-
-private:
- int a;
-};
-
-inline int A::function() {
- return 0;
-}
-//!Test simple function in header to implementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-class A {
-public:
- int function();
-
-private:
- int a;
-};
-
-inline int A::/*$*/function/*$$*/() {
- return 0;
-}
-//=
-#include
-
-class A {
-public:
- int function();
-
-private:
- int a;
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-int A::function() {
- return 0;
-}
-//!TestSimpleFunctionInImplementationToInClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include "A.h"
-
-int A::/*$*/function/*$$*/() {
- return 0;
-}
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
-public:
- int function();
-
-private:
- int a;
-};
-//=
-#include
-
-class A {
-public:
- int function() {
- return 0;
- }
-
-private:
- int a;
-};
-//!TestDifferentParameterNames
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=MyClass.cpp
-//@MyClass.cpp
-#include "MyClass.h"
-
-myClass::/*$*/myClass/*$$*/(int implname) :
- fVal(implname) {
-}
-
-int main() {
- return 0;
-}
-//=
-#include "MyClass.h"
-
-int main() {
- return 0;
-}
-//@MyClass.h
-
-struct myClass {
- int fVal;
- myClass(int headername);
-};
-
-//=
-
-struct myClass {
- int fVal;
- myClass(int implname) :
- fVal(implname) {
- }
-};
-
-//!TestMissingParameterNames
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=MyClass.cpp
-//@MyClass.cpp
-#include "MyClass.h"
-
-myClass::/*$*/myClass/*$$*/(int implname) :
- fVal(implname) {
-}
-
-int main() {
- return 0;
-}
-//=
-#include "MyClass.h"
-
-int main() {
- return 0;
-}
-//@MyClass.h
-struct myClass {
- int fVal;
- myClass(int);
-};
-//=
-struct myClass {
- int fVal;
- myClass(int implname) :
- fVal(implname) {
- }
-};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts
deleted file mode 100644
index b3249535f8d..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts
+++ /dev/null
@@ -1,131 +0,0 @@
-//!Test template function in class to in header
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-template
-class A {
- class B {
- T /*$*/member/*$$*/() {
- return T();
- }
- };
-};
-//=
-#include
-
-template
-class A {
- class B {
- T member();
- };
-};
-
-template
-inline T A::B::member() {
- return T();
-}
-//!Test template function in header to in class
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-
-template
-class A {
- class B {
- T member();
- };
-};
-
-template
-inline T A::B::/*$*/member/*$$*/() {
- return T();
-}
-//=
-#include
-
-template
-class A {
- class B {
- T member() {
- return T();
- }
- };
-};
-//!Test template function in header to in class with template selected
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- tem/*$*/plate/*$$*/
- T foo() {
- return T();
- }
-};
-//=
-class A {
- template
- T foo();
-};
-
-template
-inline T A::foo() {
- return T();
-}
-//!Test complex template function from in class to in header
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-template
-class A {
-public:
- template
- void /*$*/foo/*$$*/(const U& u, const V& v) {
- return;
- }
-};
-//=
-template
-class A {
-public:
- template
- void foo(const U& u, const V& v);
-};
-
-template
-template
-inline void A::foo(const U& u, const V& v) {
- return;
-}
-//!Test complex template function from in header to in class
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-template
-class A {
-public:
- template
- void /*$*/foo/*$$*/(const U& u, const V& v);
-};
-
-template
-template
-inline void A::foo(const U& u, const V& v) {
- return;
-}
-//=
-template
-class A {
-public:
- template
- void foo(const U& u, const V& v) {
- return;
- }
-};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts
deleted file mode 100644
index 1aa25624edb..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts
+++ /dev/null
@@ -1,262 +0,0 @@
-//!TestTryCatchFromInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-class A {
- void /*$*/member/*$$*/(int a, int b)
- try {
- return;
- }
- catch (std::exception& e1){
- return;
- }
-};
-//=
-#include
-#include
-
-class A {
- void member(int a, int b);
-};
-
-inline void A::member(int a, int b)
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-//!TestTryCatchFromInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-class A {
- void member(int a, int b);
-};
-
-inline void /*$*/A::member/*$$*/(int a, int b)
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-//=
-#include
-#include
-
-class A {
- void member(int a, int b);
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void A::member(int a, int b)
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-//!TestTryCatchFromInImplementationToClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include
-#include "A.h"
-
-void A::/*$*/member/*$$*/()
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-
-int main() {
- return 0;
-}
-//=
-#include
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
- void member();
-};
-//=
-#include
-
-class A {
- void member()
- try {
- return;
- }
- catch (std::exception& e1) {
- return;
- }
-};
-//!TestMultipleTryCatchFromInClassToInHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-class A {
- void /*$*/member/*$$*/(int a, int b)
- try {
- return;
- }
- catch (std::exception& e1) {
- return;
- }
- catch (std::exception& e2) {
- return;
- }
-};
-//=
-#include
-#include
-
-class A {
- void member(int a, int b);
-};
-
-inline void A::member(int a, int b)
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-catch (std::exception& e2) {
- return;
-}
-//!TestMultipleTryCatchFromInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-#include
-#include
-
-class A {
- void member(int a, int b);
-};
-
-inline void /*$*/A::member/*$$*/(int a, int b)
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-catch (std::exception& e2) {
- return;
-}
-//=
-#include
-#include
-
-class A {
- void member(int a, int b);
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-void A::member(int a, int b)
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-catch (std::exception& e2) {
- return;
-}
-//!TestMultipleTryCatchFromInImplementationToClass
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.cpp
-//@A.cpp
-#include
-#include "A.h"
-
-void A::/*$*/member/*$$*/()
-try {
- return;
-}
-catch (std::exception& e1) {
- return;
-}
-catch (std::exception& e2) {
- return;
-}
-
-int main() {
- return 0;
-}
-//=
-#include
-#include "A.h"
-
-int main() {
- return 0;
-}
-//@A.h
-#include
-
-class A {
- void member();
-};
-//=
-#include
-
-class A {
- void member()
- try {
- return;
- }
- catch (std::exception& e1) {
- return;
- }
- catch (std::exception& e2) {
- return;
- }
-};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts
deleted file mode 100644
index 5be3a7a7612..00000000000
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts
+++ /dev/null
@@ -1,83 +0,0 @@
-//!TestRemoveVirtualSpecifierFromClassToInheader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-
-class A {
- virtual int /*$*/foo/*$$*/() {
- return 0;
- }
-};
-//=
-
-class A {
- virtual int foo();
-};
-
-inline int A::foo() {
- return 0;
-}
-//!TestVirtualSpecifierFromInHeaderToImplementation
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//%CPP
-//@.config
-filename=A.h
-//@A.h
-class A {
- virtual int /*$*/foo/*$$*/();
-};
-
-inline int A::foo() {
- return 0;
-}
-//=
-class A {
- virtual int foo();
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-int A::foo() {
- return 0;
-}
-//!TestVirtualSpecifierFromImplementationToHeader
-//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
-//@.config
-filename=A.h
-//@A.h
-class A {
- virtual int /*$*/foo/*$$*/();
-};
-//=
-class A {
- virtual int foo() {
- return 0;
- }
-};
-//@A.cpp
-#include "A.h"
-
-int main() {
- return 0;
-}
-
-int A::foo() {
- return 0;
-}
-//=
-#include "A.h"
-
-int main() {
- return 0;
-}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java
index a2ab8fefe9c..d45db58bd66 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringHistoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2009, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -19,14 +19,14 @@ import java.util.Properties;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringContext;
+import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory;
import org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService;
-
/**
* @author Emanuel Graf IFS
*/
@@ -39,8 +39,7 @@ public class RefactoringHistoryTest extends RefactoringTest {
@Override
protected void configureRefactoring(Properties refactoringProperties) {
- scriptFile = fileMap.get(refactoringProperties.getProperty(
- "scriptFile", "refScript.xml"));
+ scriptFile = fileMap.get(refactoringProperties.getProperty("scriptFile", "refScript.xml"));
}
@Override
@@ -52,25 +51,12 @@ public class RefactoringHistoryTest extends RefactoringTest {
new ByteArrayInputStream(xmlSource.getBytes()), 0);
for (RefactoringDescriptorProxy proxy : refHist.getDescriptors()) {
RefactoringStatus status = new RefactoringStatus();
- Refactoring ref = proxy.requestDescriptor(new NullProgressMonitor()).createRefactoring(status);
+ RefactoringDescriptor descriptor = proxy.requestDescriptor(new NullProgressMonitor());
+ RefactoringContext context = descriptor.createRefactoringContext(status);
assertTrue(status.isOK());
- RefactoringStatus checkInitialConditions = ref.checkInitialConditions(NULL_PROGRESS_MONITOR);
-
- if (fatalError) {
- assertConditionsFatalError(checkInitialConditions);
- return;
- } else {
- assertConditionsOk(checkInitialConditions);
- executeRefactoring(ref);
- }
+ Refactoring refactoring = context.getRefactoring();
+ executeRefactoring(refactoring, context, false);
+ compareFiles(fileMap);
}
}
-
- protected void executeRefactoring(Refactoring refactoring) throws Exception {
- RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
- assertConditionsOk(finalConditions);
- Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);
- createChange.perform(NULL_PROGRESS_MONITOR);
- compareFiles(fileMap);
- }
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java
index 45adc3efb53..dd3d9aaae08 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -17,6 +17,10 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Properties;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringContext;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
@@ -25,17 +29,23 @@ import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.ui.testplugin.CTestPlugin;
-import org.eclipse.cdt.internal.ui.refactoring.RefactoringASTCache;
+import org.eclipse.cdt.internal.ui.refactoring.CRefactoring2;
+import org.eclipse.cdt.internal.ui.refactoring.CRefactoringContext;
/**
+ * Don't create new tests based on this class. Use RefactoringTestBase instead.
+ *
* @author Emanuel Graf
*/
public abstract class RefactoringTest extends RefactoringBaseTest {
private static final String CONFIG_FILE_NAME = ".config"; //$NON-NLS-1$
protected String fileName;
- protected RefactoringASTCache astCache;
protected boolean fatalError;
+ protected int initialErrors;
+ protected int initialWarnings;
+ protected int finalWarnings;
+ protected int finalInfos;
public RefactoringTest(String name, Collection files) {
super(name, files);
@@ -44,6 +54,62 @@ public abstract class RefactoringTest extends RefactoringBaseTest {
protected abstract void configureRefactoring(Properties refactoringProperties);
+ protected void executeRefactoring(Refactoring refactoring) throws CoreException {
+ RefactoringContext context = refactoring instanceof CRefactoring2 ?
+ new CRefactoringContext((CRefactoring2) refactoring) :
+ new RefactoringContext(refactoring);
+ executeRefactoring(refactoring, context, true);
+ }
+
+ protected void executeRefactoring(Refactoring refactoring, boolean withUserInput) throws CoreException {
+ RefactoringContext context = refactoring instanceof CRefactoring2 ?
+ new CRefactoringContext((CRefactoring2) refactoring) :
+ new RefactoringContext(refactoring);
+ executeRefactoring(refactoring, context, withUserInput);
+ }
+
+ protected void executeRefactoring(Refactoring refactoring, RefactoringContext context,
+ boolean withUserInput) throws CoreException {
+ try {
+ RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
+
+ if (fatalError) {
+ assertConditionsFatalError(checkInitialConditions);
+ return;
+ }
+ if (initialErrors != 0) {
+ assertConditionsError(checkInitialConditions, initialErrors);
+ } else if (initialWarnings != 0) {
+ assertConditionsFatalError(checkInitialConditions, initialWarnings);
+ } else {
+ assertConditionsOk(checkInitialConditions);
+ }
+
+ if (withUserInput)
+ simulateUserInput();
+
+ RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
+ if (finalWarnings > 0) {
+ assertConditionsWarning(finalConditions, finalWarnings);
+ } else if (finalInfos > 0) {
+ assertConditionsInfo(finalConditions, finalInfos);
+ } else {
+ assertConditionsOk(finalConditions);
+ }
+ Change change = refactoring.createChange(NULL_PROGRESS_MONITOR);
+ change.perform(NULL_PROGRESS_MONITOR);
+ } finally {
+ if (context != null)
+ context.dispose();
+ }
+ }
+
+ /**
+ * Subclasses can override to simulate user input.
+ */
+ protected void simulateUserInput() {
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -52,12 +118,10 @@ public abstract class RefactoringTest extends RefactoringBaseTest {
CCorePlugin.getIndexManager().reindex(cproject);
boolean joined = CCorePlugin.getIndexManager().joinIndexer(IIndexManager.FOREVER, NULL_PROGRESS_MONITOR);
assertTrue(joined);
- astCache = new RefactoringASTCache();
}
@Override
protected void tearDown() throws Exception {
- astCache.dispose();
super.tearDown();
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestBase.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestBase.java
index 5f7f26e8505..b98a640d0cb 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestBase.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestBase.java
@@ -24,9 +24,12 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringContext;
+import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
@@ -36,13 +39,18 @@ import org.osgi.framework.Bundle;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
+import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.cdt.ui.testplugin.CTestPlugin;
-import org.eclipse.cdt.internal.ui.refactoring.RefactoringASTCache;
+import org.eclipse.cdt.internal.ui.refactoring.CRefactoring2;
+import org.eclipse.cdt.internal.ui.refactoring.CRefactoringContext;
/**
* Common base for refactoring tests.
@@ -51,8 +59,9 @@ public abstract class RefactoringTestBase extends BaseTestCase {
private static final int INDEXER_TIMEOUT_SEC = 360;
protected static final NullProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
+ protected boolean createEmptyFiles = true;
+ protected boolean ascendingVisibilityOrder;
private boolean cpp = true;
- private RefactoringASTCache astCache;
private ICProject cproject;
private final Set testFiles = new LinkedHashSet();
private TestSourceFile selectedFile;
@@ -70,6 +79,7 @@ public abstract class RefactoringTestBase extends BaseTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
+ resetPreferences();
cproject = cpp ?
CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
@@ -95,7 +105,7 @@ public abstract class RefactoringTestBase extends BaseTestCase {
}
reader.close();
- if (!testFile.getSource().isEmpty()) {
+ if (createEmptyFiles || !testFile.getSource().isEmpty()) {
TestSourceReader.createFile(cproject.getProject(), new Path(testFile.getName()),
testFile.getSource());
}
@@ -111,16 +121,15 @@ public abstract class RefactoringTestBase extends BaseTestCase {
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000,
NULL_PROGRESS_MONITOR));
- astCache = new RefactoringASTCache();
}
@Override
public void tearDown() throws Exception {
- astCache.dispose();
if (cproject != null) {
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT,
NULL_PROGRESS_MONITOR);
}
+ resetPreferences();
super.tearDown();
}
@@ -134,30 +143,45 @@ public abstract class RefactoringTestBase extends BaseTestCase {
}
private void executeRefactoring(boolean expectedSuccess) throws Exception {
+ if (ascendingVisibilityOrder) {
+ getPreferenceStore().setValue(PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER,
+ ascendingVisibilityOrder);
+ }
if (historyScript != null) {
executeHistoryRefactoring(expectedSuccess);
return;
}
Refactoring refactoring = createRefactoring();
- executeRefactoring(refactoring, true, expectedSuccess);
+ RefactoringContext context;
+ if (refactoring instanceof CRefactoring2) {
+ context = new CRefactoringContext((CRefactoring2) refactoring);
+ } else {
+ context = new RefactoringContext(refactoring);
+ }
+ executeRefactoring(refactoring, context, true, expectedSuccess);
}
- protected void executeRefactoring(Refactoring refactoring, boolean withUserInput,
- boolean expectedSuccess) throws CoreException, Exception {
- RefactoringStatus initialStatus = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
- if (!expectedSuccess) {
- assertStatusFatalError(initialStatus);
- return;
- }
+ protected void executeRefactoring(Refactoring refactoring, RefactoringContext context,
+ boolean withUserInput, boolean expectedSuccess) throws CoreException, Exception {
+ try {
+ RefactoringStatus initialStatus = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
+ if (!expectedSuccess) {
+ assertStatusFatalError(initialStatus);
+ return;
+ }
- assertStatusOk(initialStatus);
- if (withUserInput)
- simulateUserInput();
- RefactoringStatus finalStatus = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
- assertStatusOk(finalStatus);
- Change change = refactoring.createChange(NULL_PROGRESS_MONITOR);
- change.perform(NULL_PROGRESS_MONITOR);
+ assertStatusOk(initialStatus);
+ if (withUserInput)
+ simulateUserInput();
+ RefactoringStatus finalStatus = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
+ assertStatusOk(finalStatus);
+ Change change = refactoring.createChange(NULL_PROGRESS_MONITOR);
+ change.perform(NULL_PROGRESS_MONITOR);
+ } finally {
+ if (context != null)
+ context.dispose();
+ }
}
private void executeHistoryRefactoring(boolean expectedSuccess) throws Exception {
@@ -166,11 +190,11 @@ public abstract class RefactoringTestBase extends BaseTestCase {
RefactoringHistory history = RefactoringHistoryService.getInstance().readRefactoringHistory(
new ByteArrayInputStream(scriptSource.getBytes()), 0);
for (RefactoringDescriptorProxy proxy : history.getDescriptors()) {
+ RefactoringDescriptor descriptor = proxy.requestDescriptor(NULL_PROGRESS_MONITOR);
RefactoringStatus status = new RefactoringStatus();
- Refactoring refactoring =
- proxy.requestDescriptor(NULL_PROGRESS_MONITOR).createRefactoring(status);
+ RefactoringContext context = descriptor.createRefactoringContext(status);
assertTrue(status.isOK());
- executeRefactoring(refactoring, false, expectedSuccess);
+ executeRefactoring(context.getRefactoring(), context, false, expectedSuccess);
}
}
@@ -199,6 +223,13 @@ public abstract class RefactoringTestBase extends BaseTestCase {
return cproject.getProject().getFile(new Path(selectedFile.getName()));
}
+ protected ITranslationUnit getSelectedTranslationUnit() {
+ IFile file = getSelectedFile();
+ if (file == null)
+ return null;
+ return (ITranslationUnit) CoreModel.getDefault().create(file);
+ }
+
protected TestSourceFile getHistoryScriptFile() {
return historyScript;
}
@@ -305,14 +336,21 @@ public abstract class RefactoringTestBase extends BaseTestCase {
}
protected String getFileContents(IFile file) throws Exception {
- BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()));
- StringBuilder code = new StringBuilder();
- String line;
- while ((line = reader.readLine()) != null) {
- code.append(line);
- code.append('\n');
- }
+ BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents(), "UTF-8"));
+ StringBuilder buffer = new StringBuilder();
+ char[] part= new char[2048];
+ int read= 0;
+ while ((read= reader.read(part)) != -1)
+ buffer.append(part, 0, read);
reader.close();
- return code.toString();
+ return buffer.toString();
+ }
+
+ protected void resetPreferences() {
+ getPreferenceStore().setToDefault(PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER);
+ }
+
+ protected IPreferenceStore getPreferenceStore() {
+ return CUIPlugin.getDefault().getPreferenceStore();
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestSuite.java
index 404b4ddde2b..79c696ce73f 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestSuite.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/RefactoringTestSuite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -16,14 +16,14 @@ package org.eclipse.cdt.ui.tests.refactoring;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantTestSuite;
+import org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableTestSuite;
-import org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTestSuite;
+import org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest;
import org.eclipse.cdt.ui.tests.refactoring.hidemethod.HideMethodTestSuite;
import org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodTestSuite;
import org.eclipse.cdt.ui.tests.refactoring.rename.RenameRegressionTests;
-import org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTestSuite;
+import org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToogleRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.utils.UtilTestSuite;
/**
@@ -36,12 +36,12 @@ public class RefactoringTestSuite extends TestSuite {
suite.addTest(UtilTestSuite.suite());
suite.addTest(RenameRegressionTests.suite());
suite.addTest(ExtractFunctionRefactoringTest.suite());
- suite.addTest(ExtractConstantTestSuite.suite());
+ suite.addTest(ExtractConstantRefactoringTest.suite());
suite.addTest(HideMethodTestSuite.suite());
- suite.addTest(GenerateGettersAndSettersTestSuite.suite());
+ suite.addTest(GenerateGettersAndSettersTest.suite());
suite.addTest(ImplementMethodTestSuite.suite());
suite.addTest(ExtractLocalVariableTestSuite.suite());
- suite.addTest(ToggleRefactoringTestSuite.suite());
+ suite.addTest(ToogleRefactoringTest.suite());
return suite;
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java
index b45d7c44a31..8cf74bdddd8 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantRefactoringTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,52 +8,788 @@
*
* Contributors:
* Institute for Software - initial API and implementation
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.extractconstant;
-import java.util.Collection;
-import java.util.Properties;
+import junit.framework.Test;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
-import org.eclipse.cdt.ui.tests.refactoring.TestSourceFile;
+import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestBase;
-import org.eclipse.cdt.internal.ui.refactoring.CRefactoring;
import org.eclipse.cdt.internal.ui.refactoring.extractconstant.ExtractConstantInfo;
import org.eclipse.cdt.internal.ui.refactoring.extractconstant.ExtractConstantRefactoring;
import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum;
/**
- * @author Emanuel Graf
+ * Tests for Extract Constant refactoring.
*/
-public class ExtractConstantRefactoringTest extends RefactoringTest {
- protected VisibilityEnum visibility;
+public class ExtractConstantRefactoringTest extends RefactoringTestBase {
+ private ExtractConstantInfo refactoringInfo;
+ private String extractedConstantName = "EXTRACTED";
+ private VisibilityEnum visibility = VisibilityEnum.v_private;
- public ExtractConstantRefactoringTest(String name, Collection files) {
- super(name, files);
+ public ExtractConstantRefactoringTest() {
+ super();
+ }
+
+ public ExtractConstantRefactoringTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return suite(ExtractConstantRefactoringTest.class);
}
@Override
- protected void runTest() throws Throwable {
- IFile refFile = project.getFile(fileName);
- ExtractConstantInfo info = new ExtractConstantInfo();
- CRefactoring refactoring = new ExtractConstantRefactoring(refFile, selection, info, cproject);
- RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
- assertConditionsOk(checkInitialConditions);
- info.setName("theAnswer"); //$NON-NLS-1$
- info.setVisibility(visibility);
- Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);
- RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
- assertConditionsOk(finalConditions);
- createChange.perform(NULL_PROGRESS_MONITOR);
- compareFiles(fileMap);
+ protected Refactoring createRefactoring() {
+ refactoringInfo = new ExtractConstantInfo();
+ return new ExtractConstantRefactoring(getSelectedFile(), getSelection(), refactoringInfo,
+ getCProject());
}
@Override
- protected void configureRefactoring(Properties refactoringProperties) {
- visibility = VisibilityEnum.getEnumForStringRepresentation(refactoringProperties.getProperty("visibility", VisibilityEnum.v_public.toString())); //$NON-NLS-1$
+ protected void simulateUserInput() {
+ refactoringInfo.setName(extractedConstantName);
+ refactoringInfo.setVisibility(visibility);
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // void bar();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // void bar();
+ //
+ //private:
+ // static const int EXTRACTED = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return /*$*/42/*$$*/; //Hello
+ //}
+ //
+ //void A::bar() {
+ // int a = 42;
+ // int b = 42;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return EXTRACTED; //Hello
+ //}
+ //
+ //void A::bar() {
+ // int a = EXTRACTED;
+ // int b = EXTRACTED;
+ //}
+ public void testExtractConstantInt() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // void bar();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // void bar();
+ //
+ //private:
+ // static const int EXTRACTED = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // //Hello
+ // return /*$*/42/*$$*/;
+ //}
+ //
+ //void A::bar() {
+ // int a = 42;
+ // int b = 42;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // //Hello
+ // return EXTRACTED;
+ //}
+ //
+ //void A::bar() {
+ // int a = EXTRACTED;
+ // int b = EXTRACTED;
+ //}
+ public void testExtractConstantInt2() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // float foo();
+ // void bar();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // float foo();
+ // void bar();
+ //
+ //private:
+ // static const float EXTRACTED = 42.0f;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //float A::foo() {
+ // return /*$*/42.0f/*$$*/;
+ //}
+ //
+ //void A::bar() {
+ // float a = 42.0f;
+ // float b = 42.0f;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //float A::foo() {
+ // return EXTRACTED;
+ //}
+ //
+ //void A::bar() {
+ // float a = EXTRACTED;
+ // float b = EXTRACTED;
+ //}
+ public void testExtractConstantFloat() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // double foo();
+ // void bar();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // double foo();
+ // void bar();
+ //
+ //private:
+ // static const double EXTRACTED = 42.0;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //double A::foo() {
+ // return /*$*/42.0/*$$*/;
+ //}
+ //
+ //void A::bar() {
+ // double a = 42.0;
+ // double b = 42.0;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //double A::foo() {
+ // return EXTRACTED;
+ //}
+ //
+ //void A::bar() {
+ // double a = EXTRACTED;
+ // double b = EXTRACTED;
+ //}
+ public void testExtractConstantDouble() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // static const int a = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // static const int a = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return 42;
+ //}
+ //
+ //int bar() {
+ // return /*$*/42/*$$*/;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //namespace {
+ //
+ //const int EXTRACTED = 42;
+ //
+ //}
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return EXTRACTED;
+ //}
+ //
+ //int bar() {
+ // return EXTRACTED;
+ //}
+ public void testExtractConstantStaticInt() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //
+ //protected:
+ // static const int EXTRACTED = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return /*$*/42/*$$*/;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return EXTRACTED;
+ //}
+ public void testReplaceNumberProtected() throws Exception {
+ visibility = VisibilityEnum.v_protected;
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //
+ //private:
+ // static const int EXTRACTED = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return /*$*/42/*$$*/;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return EXTRACTED;
+ //}
+ public void testReplaceNumberPrivate() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class X {
+ // void method() {
+ // int a = /*$*/42/*$$*/;
+ // }
+ //};
+ //====================
+ //class X {
+ //public:
+ // static const int EXTRACTED = 42;
+ //
+ //private:
+ // void method() {
+ // int a = EXTRACTED;
+ // }
+ //};
+ public void testExtractConstantFromInlinedMethod_Bug246062() throws Exception {
+ visibility = VisibilityEnum.v_public;
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class X {
+ // void method() {
+ // char* a = /*$*/"sometext"/*$$*/;
+ // }
+ //
+ // void method2() {
+ // const char* b = "sometext";
+ // }
+ //};
+ //====================
+ //class X {
+ // void method() {
+ // char* a = EXTRACTED;
+ // }
+ //
+ // void method2() {
+ // const char* b = EXTRACTED;
+ // }
+ //
+ // static const char* EXTRACTED = "sometext";
+ //};
+ public void testString() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class X {
+ // void method() {
+ // wchar_t* a = /*$*/L"sometext"/*$$*/;
+ // }
+ //
+ // void method2() {
+ // const wchar_t* b = L"sometext";
+ // const char* c = "sometext";
+ // }
+ //};
+ //====================
+ //class X {
+ // void method() {
+ // wchar_t* a = EXTRACTED;
+ // }
+ //
+ // void method2() {
+ // const wchar_t* b = EXTRACTED;
+ // const char* c = "sometext";
+ // }
+ //
+ // static const wchar_t* EXTRACTED = L"sometext";
+ //};
+ public void testExtractConstantWideString() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // void bar();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ // void bar();
+ //
+ // static const int EXTRACTED = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return 42; // Hello
+ //}
+ //
+ //void A::bar() {
+ // int a = 42;
+ // int b = 42;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return EXTRACTED; // Hello
+ //}
+ //
+ //void A::bar() {
+ // int a = EXTRACTED;
+ // int b = EXTRACTED;
+ //}
+
+ //refactoringScript.xml
+ //
+ //
+ //
+ //
+ //
+ public void testHistoryExtractConstantInt() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //
+ //protected:
+ // static const int EXTRACTED = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return 42;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return EXTRACTED;
+ //}
+
+ //refactoringScript.xml
+ //
+ //
+ //
+ //
+ public void testHistoryReplaceNumberProtected() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //};
+ //
+ //#endif /*A_H_*/
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // A();
+ // virtual ~A();
+ // int foo();
+ //
+ //private:
+ // static const int EXTRACTED = 42;
+ //};
+ //
+ //#endif /*A_H_*/
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return 42;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //A::A() {
+ //}
+ //
+ //A::~A() {
+ //}
+ //
+ //int A::foo() {
+ // return EXTRACTED;
+ //}
+
+ //refactoringScript.xml
+ //
+ //
+ //
+ //
+ public void testHistoryReplaceNumberPrivate() throws Exception {
+ assertRefactoringSuccess();
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantTestSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantTestSuite.java
deleted file mode 100644
index 6805442382a..00000000000
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractconstant/ExtractConstantTestSuite.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Google, Inc and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tom Ball (Google) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.refactoring.extractconstant;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.ui.tests.refactoring.RefactoringTester;
-
-/**
- * Test suite to run just the Extract Constant unit tests.
- *
- * @author Tom Ball
- */
-public class ExtractConstantTestSuite extends TestSuite {
-
- @SuppressWarnings("nls")
- public static Test suite() throws Exception {
- TestSuite suite = new ExtractConstantTestSuite();
- suite.addTest(RefactoringTester.suite("ExtractConstantRefactoringTest",
- "resources/refactoring/ExtractConstant.rts"));
- suite.addTest(RefactoringTester.suite("ExtractConstantHistoryRefactoringTest",
- "resources/refactoring/ExtractConstantHistory.rts"));
- return suite;
- }
-}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java
index 0654b3fc02c..cf8065c3ddd 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionRefactoringTest.java
@@ -18,10 +18,8 @@ import java.util.Map;
import junit.framework.Test;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestBase;
@@ -59,25 +57,12 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
}
@Override
- public void setUp() throws Exception {
- super.setUp();
- resetPreferences();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- resetPreferences();
- }
-
- private void resetPreferences() {
+ protected void resetPreferences() {
+ super.resetPreferences();
+ getPreferenceStore().setToDefault(PreferenceConstants.FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT);
getPreferenceStore().setToDefault(PreferenceConstants.FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER);
}
- private IPreferenceStore getPreferenceStore() {
- return CUIPlugin.getDefault().getPreferenceStore();
- }
-
@Override
protected Refactoring createRefactoring() {
refactoringInfo = new ExtractFunctionInformation();
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java
index 4cfec842af2..c63817296ba 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -7,7 +7,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Tom Ball (Google) - initial API and implementation
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable;
@@ -15,14 +16,12 @@ import java.util.Collection;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.TestSourceFile;
-import org.eclipse.cdt.internal.ui.refactoring.CRefactoring;
-import org.eclipse.cdt.internal.ui.refactoring.NameNVisibilityInformation;
import org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable.ExtractLocalVariableRefactoring;
/**
@@ -32,7 +31,6 @@ import org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable.ExtractLocal
*/
public class ExtractLocalVariableRefactoringTest extends RefactoringTest {
protected String variableName;
- protected boolean fatalError;
public ExtractLocalVariableRefactoringTest(String name, Collection files) {
super(name, files);
@@ -40,22 +38,12 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTest {
@Override
protected void runTest() throws Throwable {
- IFile refFile = project.getFile(fileName);
- NameNVisibilityInformation info = new NameNVisibilityInformation();
- info.setName(variableName);
- CRefactoring refactoring = new ExtractLocalVariableRefactoring( refFile, selection, info, cproject);
- RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
-
- if (fatalError){
- assertConditionsFatalError(checkInitialConditions);
- return;
- }
-
- assertConditionsOk(checkInitialConditions);
- Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);
- RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
- assertConditionsOk(finalConditions);
- createChange.perform(NULL_PROGRESS_MONITOR);
+ IFile file = project.getFile(fileName);
+ ICElement element = CoreModel.getDefault().create(file);
+ ExtractLocalVariableRefactoring refactoring =
+ new ExtractLocalVariableRefactoring(element, selection, cproject);
+ refactoring.getRefactoringInfo().setName(variableName);
+ executeRefactoring(refactoring);
compareFiles(fileMap);
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java
index 2cdeca22683..a7123d396c5 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTest.java
@@ -1,123 +1,1603 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
- * Rapperswil, University of applied sciences
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
* Contributors:
- * Emanuel Graf & Leo Buettiker - initial API and implementation
- * Thomas Corbat - implementation
+ * Institute for Software - initial API and implementation
* Sergey Prigogin (Google)
- ******************************************************************************/
+ *******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.gettersandsetters;
-import java.util.Collection;
-import java.util.Properties;
+import junit.framework.Test;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
-import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
-import org.eclipse.cdt.ui.tests.refactoring.TestSourceFile;
+import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestBase;
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.AccessorDescriptor.AccessorKind;
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GenerateGettersAndSettersRefactoring;
import org.eclipse.cdt.internal.ui.refactoring.gettersandsetters.GetterSetterContext;
/**
- * @author Thomas Corbat
+ * Tests for Generate Getters and Setters refactoring.
*/
-public class GenerateGettersAndSettersTest extends RefactoringTest {
- protected boolean fatalError;
- private int warnings;
- private int infos;
+public class GenerateGettersAndSettersTest extends RefactoringTestBase {
private String[] selectedGetters;
private String[] selectedSetters;
- private GenerateGettersAndSettersRefactoring refactoring;
private boolean definitionSeparate;
- private String ascendingVisibilityOrder;
+ private GenerateGettersAndSettersRefactoring refactoring;
- /**
- * @param name
- * @param files
- */
- public GenerateGettersAndSettersTest(String name, Collection files) {
- super(name, files);
+ public GenerateGettersAndSettersTest() {
+ super();
+ }
+
+ public GenerateGettersAndSettersTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return suite(GenerateGettersAndSettersTest.class);
}
@Override
- protected void runTest() throws Throwable {
- try {
- IFile file = project.getFile(fileName);
- ICElement element = CoreModel.getDefault().create(file);
- refactoring = new GenerateGettersAndSettersRefactoring(element, selection, cproject, astCache);
- RefactoringStatus initialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
+ public void setUp() throws Exception {
+ super.setUp();
+ resetPreferences();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ resetPreferences();
+ }
- if (fatalError) {
- assertConditionsFatalError(initialConditions);
- return;
- } else {
- assertConditionsOk(initialConditions);
- executeRefactoring();
- }
- } finally {
- IPreferenceStore store= CUIPlugin.getDefault().getPreferenceStore();
- store.setToDefault(PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER);
+ @Override
+ protected Refactoring createRefactoring() {
+ if (ascendingVisibilityOrder) {
+ getPreferenceStore().setValue(PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER,
+ ascendingVisibilityOrder);
}
+ refactoring = new GenerateGettersAndSettersRefactoring(getSelectedTranslationUnit(), getSelection(),
+ getCProject());
+ return refactoring;
}
- private void executeRefactoring() throws CoreException, Exception {
- if (ascendingVisibilityOrder != null) {
- IPreferenceStore store= CUIPlugin.getDefault().getPreferenceStore();
- store.setValue(PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER, ascendingVisibilityOrder);
- }
- selectFields();
- refactoring.getContext().setDefinitionSeparate(definitionSeparate);
- RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
- Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);
- if (warnings > 0) {
- assertConditionsWarning(finalConditions, warnings);
- } else if (infos > 0) {
- assertConditionsInfo(finalConditions, infos);
- } else {
- assertConditionsOk(finalConditions);
- }
-
- createChange.perform(NULL_PROGRESS_MONITOR);
- compareFiles(fileMap);
- }
-
- private void selectFields() {
+ @Override
+ protected void simulateUserInput() {
GetterSetterContext context = refactoring.getContext();
-
- for (String name : selectedGetters) {
- context.selectAccessorForField(name, AccessorKind.GETTER);
+
+ if (selectedGetters != null) {
+ for (String name : selectedGetters) {
+ context.selectAccessorForField(name, AccessorKind.GETTER);
+ }
}
- for (String name : selectedSetters) {
- context.selectAccessorForField(name, AccessorKind.SETTER);
+ if (selectedSetters != null) {
+ for (String name : selectedSetters) {
+ context.selectAccessorForField(name, AccessorKind.SETTER);
+ }
}
+ context.setDefinitionSeparate(definitionSeparate);
}
-
- @Override
- protected void configureRefactoring(Properties refactoringProperties) {
- fatalError = Boolean.valueOf(refactoringProperties.getProperty("fatalerror", "false")).booleanValue(); //$NON-NLS-1$//$NON-NLS-2$
- warnings = new Integer(refactoringProperties.getProperty("warnings", "0")).intValue(); //$NON-NLS-1$//$NON-NLS-2$
- infos = new Integer(refactoringProperties.getProperty("infos", "0"));
- String getters = refactoringProperties.getProperty("getters", ""); //$NON-NLS-1$ //$NON-NLS-2$
- String setters = refactoringProperties.getProperty("setters", ""); //$NON-NLS-1$ //$NON-NLS-2$
- definitionSeparate = Boolean.valueOf(refactoringProperties.getProperty("definitionSeparate", "false"));
- ascendingVisibilityOrder = refactoringProperties.getProperty("ascendingVisibilityOrder", null);
-
- selectedGetters = getters.split(",");
- selectedSetters = setters.split(",");
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //
+ // char* getName() const {
+ // return name;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ public void testOneGetterSelection() throws Exception {
+ selectedGetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //namespace Personal {
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //}
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //namespace Personal {
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //
+ // char* getName() const {
+ // return name;
+ // }
+ //};
+ //
+ //}
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ public void testOneGetterSelectionWithNamespace() throws Exception {
+ selectedGetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //
+ // void setName(char* name) {
+ // this->name = name;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ public void testOneSetterSelection() throws Exception {
+ selectedSetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //
+ // char* getName() const {
+ // return name;
+ // }
+ //
+ // void setName(char* name) {
+ // this->name = name;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ public void testGetterAndSetterSelection() throws Exception {
+ selectedGetters = new String[] { "name" };
+ selectedSetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // char* getName() const {
+ // return name;
+ // }
+ //
+ // void setName(char* name) {
+ // this->name = name;
+ // }
+ //
+ // int getSystemId() const {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ public void testMultipleSelection() throws Exception {
+ selectedGetters = new String[] { "name", "systemId" };
+ selectedSetters = new String[] { "name", "systemId" };
+ assertRefactoringSuccess();
+ }
+
+ //GaS.h
+ //#ifndef GAS_H_
+ //#define GAS_H_
+ //
+ //class GaS {
+ //public:
+ // GaS();
+ // virtual ~GaS();
+ // bool /*$*/ok/*$$*/;
+ // void method2();
+ //
+ //private:
+ // int i;
+ //};
+ //
+ //#endif
+ //====================
+ //#ifndef GAS_H_
+ //#define GAS_H_
+ //
+ //class GaS {
+ //public:
+ // GaS();
+ // virtual ~GaS();
+ // bool ok;
+ // void method2();
+ //
+ // int getI() const {
+ // return i;
+ // }
+ //
+ // void setI(int i) {
+ // this->i = i;
+ // }
+ //
+ // bool isOk() const {
+ // return ok;
+ // }
+ //
+ // void setOk(bool ok) {
+ // this->ok = ok;
+ // }
+ //
+ //private:
+ // int i;
+ //};
+ //
+ //#endif
+
+ //GaS.cpp
+ //#include "Getters.h"
+ //
+ //GaS::Getters() {
+ //}
+ //
+ //GaS::~Getters() {
+ //}
+ public void testVisibilityOrder() throws Exception {
+ selectedGetters = new String[] { "i", "ok" };
+ selectedSetters = new String[] { "i", "ok" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int /*$*/id/*$$*/;
+ //};
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //public:
+ // int getId() const {
+ // return id;
+ // }
+ //
+ // void setId(int id) {
+ // this->id = id;
+ // }
+ //
+ //private:
+ // int id;
+ //};
+ //
+ //#endif /* A_H_ */
+ public void testNoMethods() throws Exception {
+ selectedGetters = new String[] { "id" };
+ selectedSetters = new String[] { "id" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ ///*
+ // * test.h
+ // */
+ //
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ ////comment1
+ //class test {
+ // int /*$*/i/*$$*/; //comment2
+ // char* b;
+ // //comment3
+ //};
+ //
+ //#endif /* TEST_H_ */
+ //====================
+ ///*
+ // * test.h
+ // */
+ //
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ ////comment1
+ //class test {
+ // int i; //comment2
+ // char* b;
+ // //comment3
+ //
+ //public:
+ // int getI() const {
+ // return i;
+ // }
+ //
+ // void setI(int i) {
+ // this->i = i;
+ // }
+ //};
+ //
+ //#endif /* TEST_H_ */
+ public void testNoMethodsAscendingVisibilityOrder() throws Exception {
+ selectedGetters = new String[] { "i" };
+ selectedSetters = new String[] { "i" };
+ ascendingVisibilityOrder = true;
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ ///*
+ // * test.h
+ // */
+ //
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ ////comment1
+ //class test {
+ // void /*$*/test/*$$*/();
+ // //comment3
+ //};
+ //
+ //#endif /* TEST_H_ */
+ //====================
+ ///*
+ // * test.h
+ // */
+ //
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ ////comment1
+ //class test {
+ // void test();
+ // //comment3
+ //};
+ //
+ //#endif /* TEST_H_ */
+ public void testNoFields() throws Exception {
+ assertRefactoringFailure();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //struct FullName {
+ // const char* first;
+ // const char* last;
+ // FullName(const FullName& other);
+ // ~FullName();
+ //};
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // FullName name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId();
+ //
+ // void setSystemId(int systemId);
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //struct FullName {
+ // const char* first;
+ // const char* last;
+ // FullName(const FullName& other);
+ // ~FullName();
+ //};
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // FullName name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId();
+ //
+ // void setSystemId(int systemId);
+ // const FullName& getName() const;
+ // void setName(const FullName& name);
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //const FullName& Person::getName() const {
+ // return name;
+ //}
+ //
+ //void Person::setName(const FullName& name) {
+ // this->name = name;
+ //}
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ public void testPassByReferenceSeparateDefinition() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "name" };
+ selectedSetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //namespace Personal {
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //}
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //namespace Personal {
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //
+ // char* getName() const;
+ //};
+ //
+ //}
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //namespace Personal {
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //} // namespace Personal
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //namespace Personal {
+ //
+ //char* Person::getName() const {
+ // return name;
+ //}
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //} // namespace Personal
+ //
+ //int main(int argc, char** argv) {
+ //}
+ public void testOneGetterSelectionWithNamespaceSeparateDefinition() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //
+ // void setName(char* name);
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //void Person::setName(char* name) {
+ // this->name = name;
+ //}
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ public void testOneSetterSelectionSeparateDefinition() throws Exception {
+ definitionSeparate = true;
+ selectedSetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int /*$*/SocSecNo/*$$*/();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int systemId;
+ //
+ //protected:
+ // char* name;
+ //
+ //public:
+ // const int socSecNo;
+ //
+ // Person myFriend;
+ //
+ // Person(int socSecNo); // constructor
+ //
+ // ~Person(); // destructor
+ //
+ // char* Name();
+ //
+ // void Print();
+ //
+ // int SocSecNo();
+ //
+ // int GetUniqueId();
+ //
+ // int getSystemId() {
+ // return systemId;
+ // }
+ //
+ // void setSystemId(int systemId) {
+ // this->systemId = systemId;
+ // }
+ //
+ // char* getName() const;
+ // void setName(char* name);
+ //};
+ //
+ //int gooo = 1;
+ //
+ //#endif /* A_H_ */
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //char* Person::getName() const {
+ // return name;
+ //}
+ //
+ //void Person::setName(char* name) {
+ // this->name = name;
+ //}
+ //
+ //int Person::SocSecNo() {
+ // return socSecNo;
+ //}
+ //
+ //int main(int argc, char** argv) {
+ //}
+ public void testSelectionWithSeparateDefinition() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "name" };
+ selectedSetters = new String[] { "name" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //private:
+ // int /*$*/id/*$$*/;
+ //};
+ //
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class Person {
+ //public:
+ // int getId() const;
+ // void setId(int id);
+ //
+ //private:
+ // int id;
+ //};
+ //
+ //inline int Person::getId() const {
+ // return id;
+ //}
+ //
+ //inline void Person::setId(int id) {
+ // this->id = id;
+ //}
+ //
+ //#endif /* A_H_ */
+ public void testNoMethodsSeparateDefinition_1() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "id" };
+ selectedSetters = new String[] { "id" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ ///*
+ // * test.h
+ // */
+ //
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ ////comment1
+ //class test {
+ // int /*$*/i/*$$*/; //comment2
+ // char* b;
+ // //comment3
+ //};
+ //
+ //#endif /* TEST_H_ */
+ //====================
+ ///*
+ // * test.h
+ // */
+ //
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ ////comment1
+ //class test {
+ //public:
+ // int getI() const;
+ // void setI(int i);
+ //
+ //private:
+ // int i; //comment2
+ // char* b;
+ // //comment3
+ //};
+ //
+ //inline int test::getI() const {
+ // return i;
+ //}
+ //
+ //inline void test::setI(int i) {
+ // this->i = i;
+ //}
+ //
+ //#endif /* TEST_H_ */
+ public void testNoMethodsSeparateDefinition_2() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "i" };
+ selectedSetters = new String[] { "i" };
+ assertRefactoringSuccess();
+ }
+
+ //Test.h
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ //namespace foo {
+ //
+ //class Test {
+ // int /*$*/testField/*$$*/;
+ // void foo();
+ //};
+ //
+ //} // namespace foo
+ //
+ //#endif
+ //====================
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ //namespace foo {
+ //
+ //class Test {
+ //public:
+ // int getTestField() const;
+ // void setTestField(int testField);
+ //
+ //private:
+ // int testField;
+ // void foo();
+ //};
+ //
+ //} // namespace foo
+ //
+ //#endif
+
+ //Test.cpp
+ //#include "Test.h"
+ //
+ //namespace foo {
+ //
+ //void Test::foo() {
+ //}
+ //
+ //}
+ //====================
+ //#include "Test.h"
+ //
+ //namespace foo {
+ //
+ //int Test::getTestField() const {
+ // return testField;
+ //}
+ //
+ //void Test::setTestField(int testField) {
+ // this->testField = testField;
+ //}
+ //
+ //void Test::foo() {
+ //}
+ //
+ //}
+ public void testBug323780() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "testField" };
+ selectedSetters = new String[] { "testField" };
+ assertRefactoringSuccess();
+ }
+
+ //Test.h
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ //class Test {
+ // int /*$*/testField/*$$*/;
+ //};
+ //
+ //#endif
+ //====================
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ //class Test {
+ //public:
+ // int getTestField() const;
+ // void setTestField(int testField);
+ //
+ //private:
+ // int testField;
+ //};
+ //
+ //#endif
+
+ //Test.cxx
+ //====================
+ //int Test::getTestField() const {
+ // return testField;
+ //}
+ //
+ //void Test::setTestField(int testField) {
+ // this->testField = testField;
+ //}
+ public void testInsertDefinitionInEmptyImplementationFile_Bug337040_1() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "testField" };
+ selectedSetters = new String[] { "testField" };
+ assertRefactoringSuccess();
+ }
+
+ //component_b/public_headers/Test.h
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ //class Test {
+ // int /*$*/testField/*$$*/;
+ //};
+ //
+ //#endif
+ //====================
+ //#ifndef TEST_H_
+ //#define TEST_H_
+ //
+ //class Test {
+ //public:
+ // int getTestField() const;
+ // void setTestField(int testField);
+ //
+ //private:
+ // int testField;
+ //};
+ //
+ //#endif
+
+ //component_b/implementation/Test.cpp
+ //====================
+ //int Test::getTestField() const {
+ // return testField;
+ //}
+ //
+ //void Test::setTestField(int testField) {
+ // this->testField = testField;
+ //}
+
+ //component_a/public_headers/Test.h
+ //====================
+
+ //component_a/implementation/Test.cpp
+ //====================
+ public void testInsertDefinitionInEmptyImplementationFile_Bug337040_2() throws Exception {
+ definitionSeparate = true;
+ selectedGetters = new String[] { "testField" };
+ selectedSetters = new String[] { "testField" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //#define Typedef \
+ // typedef int Int
+ //
+ //class Test
+ //{
+ //public:
+ // Typedef;
+ //
+ // void Foo();
+ // Test();
+ //
+ // int /*$*/test/*$$*/;
+ //};
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //#define Typedef \
+ // typedef int Int
+ //
+ //class Test
+ //{
+ //public:
+ // Typedef;
+ //
+ // void Foo();
+ // Test();
+ //
+ // int getTest() const {
+ // return test;
+ // }
+ //
+ // int test;
+ //};
+ //#endif /* A_H_ */
+ public void testClassWithMacro_Bug363244() throws Exception {
+ selectedGetters = new String[] { "test" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //private:
+ // int /*$*/a[2]/*$$*/;
+ //};
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class A {
+ //public:
+ // const int* getA() const {
+ // return a;
+ // }
+ //
+ //private:
+ // int a[2];
+ //};
+ //#endif /* A_H_ */
+ public void testGetterForAnArrayField_Bug319278() throws Exception {
+ selectedGetters = new String[] { "a" };
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class getClass {
+ //private:
+ // int /*$*/mClass/*$$*/;
+ //};
+ //#endif /* A_H_ */
+ //====================
+ //#ifndef A_H_
+ //#define A_H_
+ //
+ //class getClass {
+ //public:
+ // int getClass1() const {
+ // return mClass;
+ // }
+ //
+ // void setClass(int clazz) {
+ // mClass = clazz;
+ // }
+ //
+ //private:
+ // int mClass;
+ //};
+ //#endif /* A_H_ */
+ public void testAvoidingReservedNames_Bug352258() throws Exception {
+ selectedGetters = new String[] { "mClass" };
+ selectedSetters = new String[] { "mClass" };
+ assertRefactoringSuccess();
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTestSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTestSuite.java
deleted file mode 100644
index 32b524725d9..00000000000
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/gettersandsetters/GenerateGettersAndSettersTestSuite.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Google, Inc and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tom Ball (Google) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.refactoring.gettersandsetters;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.ui.tests.refactoring.RefactoringTester;
-
-/**
- * Test suite to run just the Generate Getters and Setters unit tests.
- *
- * @author Tom Ball
- */
-public class GenerateGettersAndSettersTestSuite extends TestSuite {
-
- @SuppressWarnings("nls")
- public static Test suite() throws Exception {
- TestSuite suite = new GenerateGettersAndSettersTestSuite();
- suite.addTest(RefactoringTester.suite("GenerateGettersAndSettersTest",
- "resources/refactoring/GenerateGettersAndSetters.rts"));
- return suite;
- }
-}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java
index 125110811ca..fb7aee5b765 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/hidemethod/HideMethodRefactoringTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Institute for Software - initial API and implementation
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.hidemethod;
@@ -15,22 +16,17 @@ import java.util.Collection;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.TestSourceFile;
-import org.eclipse.cdt.internal.ui.refactoring.CRefactoring;
import org.eclipse.cdt.internal.ui.refactoring.hidemethod.HideMethodRefactoring;
/**
* @author Guido Zgraggen IFS
*/
public class HideMethodRefactoringTest extends RefactoringTest {
- private int warnings;
- private int errors;
- private int fatalerrors;
public HideMethodRefactoringTest(String name, Collection files) {
super(name, files);
@@ -39,32 +35,15 @@ public class HideMethodRefactoringTest extends RefactoringTest {
@Override
protected void runTest() throws Throwable {
IFile refFile = project.getFile(fileWithSelection);
- CRefactoring refactoring = new HideMethodRefactoring(refFile,selection, null, cproject);
- RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
- if (errors > 0) {
- assertConditionsError(checkInitialConditions, errors);
- } else if (fatalerrors > 0) {
- assertConditionsError(checkInitialConditions, errors);
- return;
- } else {
- assertConditionsOk(checkInitialConditions);
- }
-
- Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);
- RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
- if (warnings > 0) {
- assertConditionsWarning(finalConditions, warnings);
- } else {
- assertConditionsOk(finalConditions);
- }
- createChange.perform(NULL_PROGRESS_MONITOR);
+ Refactoring refactoring = new HideMethodRefactoring(refFile,selection, null, cproject);
+ executeRefactoring(refactoring);
compareFiles(fileMap);
}
@Override
protected void configureRefactoring(Properties refactoringProperties) {
- warnings = new Integer(refactoringProperties.getProperty("warnings", "0")).intValue(); //$NON-NLS-1$//$NON-NLS-2$
- errors = new Integer(refactoringProperties.getProperty("errors", "0")).intValue(); //$NON-NLS-1$//$NON-NLS-2$
- fatalerrors = new Integer(refactoringProperties.getProperty("fatalerrors", "0")).intValue(); //$NON-NLS-1$//$NON-NLS-2$
+ fatalError = Boolean.valueOf(refactoringProperties.getProperty("fatalerror", "false")).booleanValue(); //$NON-NLS-1$//$NON-NLS-2$
+ finalWarnings = new Integer(refactoringProperties.getProperty("warnings", "0")).intValue(); //$NON-NLS-1$//$NON-NLS-2$
+ initialErrors = new Integer(refactoringProperties.getProperty("errors", "0")).intValue(); //$NON-NLS-1$//$NON-NLS-2$
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java
index 9d5d147179c..199b2aa73a2 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
* Institute for Software - initial API and implementation
* Marc-Andre Laperle
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.implementmethod;
@@ -16,8 +17,6 @@ import java.util.Collection;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
@@ -31,9 +30,6 @@ import org.eclipse.cdt.internal.ui.refactoring.implementmethod.ImplementMethodRe
* @author Mirko Stocker
*/
public class ImplementMethodRefactoringTest extends RefactoringTest {
- protected int finalWarnings;
- private int initialWarnings;
- private int infos;
public ImplementMethodRefactoringTest(String name, Collection files) {
super(name, files);
@@ -43,28 +39,8 @@ public class ImplementMethodRefactoringTest extends RefactoringTest {
protected void runTest() throws Throwable {
IFile refFile = project.getFile(fileName);
ICElement element = CoreModel.getDefault().create(refFile);
- CRefactoring2 refactoring = new ImplementMethodRefactoring(element, selection, cproject, astCache);
- RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
-
- if (initialWarnings == 0) {
- assertConditionsOk(checkInitialConditions);
- } else {
- assertConditionsFatalError(checkInitialConditions, initialWarnings);
- return;
- }
-
- RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
- Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);
-
- if (finalWarnings > 0) {
- assertConditionsWarning(finalConditions, finalWarnings);
- } else if (infos > 0) {
- assertConditionsInfo(finalConditions, infos);
- } else {
- assertConditionsOk(finalConditions);
- }
-
- createChange.perform(NULL_PROGRESS_MONITOR);
+ CRefactoring2 refactoring = new ImplementMethodRefactoring(element, selection, cproject);
+ executeRefactoring(refactoring);
compareFiles(fileMap);
}
@@ -72,6 +48,6 @@ public class ImplementMethodRefactoringTest extends RefactoringTest {
protected void configureRefactoring(Properties refactoringProperties) {
finalWarnings = new Integer(refactoringProperties.getProperty("finalWarnings", "0")).intValue(); //$NON-NLS-1$//$NON-NLS-2$
initialWarnings = Integer.parseInt(refactoringProperties.getProperty("initialWarnings", "0")); //$NON-NLS-1$//$NON-NLS-2$
- infos = Integer.parseInt(refactoringProperties.getProperty("infos", "0")); //$NON-NLS-1$//$NON-NLS-2$
+ finalInfos = Integer.parseInt(refactoringProperties.getProperty("infos", "0")); //$NON-NLS-1$//$NON-NLS-2$
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/MockToggleRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/MockToggleRefactoringTest.java
deleted file mode 100644
index 27196fdda6b..00000000000
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/MockToggleRefactoringTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Institute for Software, HSR Hochschule fuer Technik
- * Rapperswil, University of applied sciences and others
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Institute for Software - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.refactoring.togglefunction;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.TextSelection;
-
-import org.eclipse.cdt.core.model.ICProject;
-
-import org.eclipse.cdt.internal.ui.refactoring.togglefunction.ToggleRefactoring;
-import org.eclipse.cdt.internal.ui.refactoring.togglefunction.ToggleRefactoringContext;
-
-public class MockToggleRefactoringTest extends ToggleRefactoring {
-
- public MockToggleRefactoringTest(IFile file, TextSelection selection, ICProject proj) {
- super(file, selection, proj);
- }
-
- public ToggleRefactoringContext getContext() {
- return context;
- }
-}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java
deleted file mode 100644
index 32cc7e37448..00000000000
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Institute for Software, HSR Hochschule fuer Technik
- * Rapperswil, University of applied sciences and others
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Institute for Software - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.refactoring.togglefunction;
-
-import java.util.Collection;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-
-import org.eclipse.cdt.core.parser.tests.rewrite.TestHelper;
-import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
-import org.eclipse.cdt.ui.tests.refactoring.TestSourceFile;
-
-public class ToggleRefactoringTest extends RefactoringTest {
- private boolean fatalError;
- private boolean newFileCreation;
- private String[] newfiles;
-
- public ToggleRefactoringTest(String name, Collection files) {
- super(name, files);
- }
-
- @Override
- protected void configureRefactoring(Properties refactoringProperties) {
- fatalError = Boolean.valueOf(refactoringProperties.getProperty("fatalerror", "false")).booleanValue(); //$NON-NLS-1$ //$NON-NLS-2$
- newFileCreation = Boolean.valueOf(refactoringProperties.getProperty("newfilecreation", "false")).booleanValue();
- newfiles = separateNewFiles(refactoringProperties);
- }
-
- private String[] separateNewFiles(Properties refactoringProperties) {
- return String.valueOf(refactoringProperties.getProperty("newfiles", "")).replace(" ", "").split(",");
- }
-
- @Override
- protected void runTest() throws Throwable {
- MockToggleRefactoringTest refactoring = new MockToggleRefactoringTest(project.getFile(fileName), selection, cproject);
- if (newFileCreation) {
- pre_executeNewFileCreationRefactoring(refactoring);
- RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
- refactoring.getContext().setSettedDefaultAnswer(true);
- refactoring.getContext().setDefaultAnswer(true);
- if (fatalError) {
- assertConditionsFatalError(checkInitialConditions);
- return;
- }
- assertConditionsOk(checkInitialConditions);
- aftertest(refactoring);
- return;
- } else {
- RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
- if (fatalError) {
- assertConditionsFatalError(checkInitialConditions);
- return;
- }
- assertConditionsOk(checkInitialConditions);
- executeRefactoring(refactoring);
- }
- }
-
- private void aftertest(Refactoring refactoring) throws Exception {
- Change changes = refactoring.createChange(NULL_PROGRESS_MONITOR);
- assertConditionsOk(refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR));
- changes.perform(NULL_PROGRESS_MONITOR);
- filesDoExist();
- for (String fileName: fileMap.keySet()) {
- IFile iFile = project.getFile(new Path(fileName));
- String code = getCodeFromIFile(iFile);
- String expectedSource = fileMap.get(fileName).getExpectedSource();
- assertEquals(TestHelper.unifyNewLines(expectedSource), TestHelper.unifyNewLines(code));
- }
- }
-
- private void pre_executeNewFileCreationRefactoring(Refactoring refactoring) throws Exception {
- removeFiles();
- filesDoNotExist();
- }
-
- private void filesDoExist() {
- for (String fileName: newfiles) {
- IFile file = project.getFile(new Path(fileName));
- assertTrue(file.exists());
- }
- }
-
- private void filesDoNotExist() {
- for (String fileName: newfiles) {
- IFile file = project.getFile(new Path(fileName));
- assertFalse(file.exists());
- }
- }
-
- private void removeFiles() throws CoreException {
- for (String fileName: newfiles) {
- IFile file = project.getFile(new Path(fileName));
- file.delete(true, NULL_PROGRESS_MONITOR);
- }
- }
-
- private void executeRefactoring(Refactoring refactoring) throws Exception {
- Change changes = refactoring.createChange(NULL_PROGRESS_MONITOR);
- assertConditionsOk(refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR));
- changes.perform(NULL_PROGRESS_MONITOR);
- compareFiles(fileMap);
- }
-}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTestSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTestSuite.java
deleted file mode 100644
index cc0ff4bc61e..00000000000
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTestSuite.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Institute for Software, HSR Hochschule fuer Technik
- * Rapperswil, University of applied sciences and others
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Institute for Software - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.refactoring.togglefunction;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.ui.tests.refactoring.RefactoringTester;
-
-public class ToggleRefactoringTestSuite extends TestSuite {
-
- @SuppressWarnings("nls")
- public static Test suite() throws Exception {
- TestSuite suite = new ToggleRefactoringTestSuite();
- suite.addTest(RefactoringTester.suite("NewCreationTest",
- "resources/refactoring/NewCreationTest.rts"));
- suite.addTest(RefactoringTester.suite("ToggleErrorRefactoring",
- "resources/refactoring/ToggleErrorRefactoring.rts"));
- suite.addTest(RefactoringTester.suite("ToggleSelectionTest",
- "resources/refactoring/ToggleSelection.rts"));
- suite.addTest(RefactoringTester.suite(
- "ToggleSimpleFunctionRefactoringTest",
- "resources/refactoring/ToggleSimpleFunctionRefactoring.rts"));
- suite.addTest(RefactoringTester.suite("ToggleTemplateRefactoringTest",
- "resources/refactoring/ToggleTemplateRefactoring.rts"));
- suite.addTest(RefactoringTester.suite("ToggleNamespaceRefactoringTest",
- "resources/refactoring/ToggleNamespaceRefactoring.rts"));
- suite.addTest(RefactoringTester.suite("ToggleTryCatchRefactoringTest",
- "resources/refactoring/ToggleTryCatchRefactoring.rts"));
- suite.addTest(RefactoringTester.suite(
- "ToggleDefaultParameterRefactoringTest",
- "resources/refactoring/ToggleDefaultParameterRefactoring.rts"));
- suite.addTest(RefactoringTester.suite("ToggleCtorDtorRefactoringTest",
- "resources/refactoring/ToggleCtorDtorRefactoring.rts"));
- suite.addTest(RefactoringTester.suite("ToggleNestedRefactoringTest",
- "resources/refactoring/ToggleNestedRefactoring.rts"));
- suite.addTest(RefactoringTester.suite("ToggleDifferentSelectionsTest",
- "resources/refactoring/ToggleDifferentSelections.rts"));
- suite.addTest(RefactoringTester.suite("ToggleFreeFunctionTest",
- "resources/refactoring/ToggleFreeFunction.rts"));
- suite.addTest(RefactoringTester.suite("ToggleVirtualFunctionTest",
- "resources/refactoring/ToggleVirtualFunction.rts"));
- suite.addTest(RefactoringTester.suite("ToggleOrderingTest",
- "resources/refactoring/ToggleOrdering.rts"));
- suite.addTest(RefactoringTester.suite("ToggleCommentsClassToHeader",
- "resources/refactoring/ToggleCommentsClassToHeader.rts"));
- suite.addTest(RefactoringTester.suite("ToggleCommentsHeaderToClass",
- "resources/refactoring/ToggleCommentsHeaderToClass.rts"));
- suite.addTest(RefactoringTester.suite("ToggleCommentsHeaderToImpl",
- "resources/refactoring/ToggleCommentsHeaderToImpl.rts"));
- suite.addTest(RefactoringTester.suite("ToggleCommentsImplToHeader",
- "resources/refactoring/ToggleCommentsImplToHeader.rts"));
- suite.addTestSuite(ToggleNodeHelperTest.class);
- return suite;
- }
-}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToogleRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToogleRefactoringTest.java
new file mode 100644
index 00000000000..6e72349d1eb
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToogleRefactoringTest.java
@@ -0,0 +1,2865 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Institute for Software - initial API and implementation
+ * Sergey Prigogin (Google)
+ *******************************************************************************/
+package org.eclipse.cdt.ui.tests.refactoring.togglefunction;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.ltk.core.refactoring.Refactoring;
+
+import org.eclipse.cdt.ui.tests.refactoring.RefactoringTestBase;
+
+import org.eclipse.cdt.internal.ui.refactoring.togglefunction.ToggleRefactoring;
+
+/**
+ * Tests for Generate Getters and Setters refactoring.
+ */
+public class ToogleRefactoringTest extends RefactoringTestBase {
+ private ToggleRefactoring refactoring;
+
+ public ToogleRefactoringTest() {
+ super();
+ }
+
+ public ToogleRefactoringTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = suite(ToogleRefactoringTest.class);
+ suite.addTestSuite(ToggleNodeHelperTest.class);
+ return suite;
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ createEmptyFiles = false;
+ super.setUp();
+ }
+
+ @Override
+ protected Refactoring createRefactoring() {
+ refactoring = new ToggleRefactoring(getSelectedFile(), getSelection(), getCProject());
+ return refactoring;
+ }
+
+ @Override
+ protected void simulateUserInput() {
+ refactoring.getContext().setSettedDefaultAnswer(true);
+ refactoring.getContext().setDefaultAnswer(true);
+ }
+
+ //A.h
+ //void /*$*/freefunction/*$$*/() {
+ // return;
+ //}
+ //====================
+ //void freefunction();
+
+ //A.cpp
+ //====================
+ //#include "A.h"
+ //
+ //void freefunction() {
+ // return;
+ //}
+ public void testFileCreationFreeFunctionFromHeaderToImpl() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.cpp
+ //void /*$*/freefunction/*$$*/() {
+ // return;
+ //}
+ //====================
+ //#include "A.h"
+ //
+
+ //A.h
+ //====================
+ //void freefunction() {
+ // return;
+ //}
+ public void testFileCreationFromImplToHeader() throws Exception {
+ createEmptyFiles = false;
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //void /*$*/freefunction/*$$*/() {
+ // return;
+ //}
+ //====================
+ //void freefunction();
+
+ //A.cpp
+ //====================
+ //#include "A.h"
+ //
+ //void freefunction() {
+ // return;
+ //}
+ public void testFreeFunctionFromHeaderToImpl() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.cpp
+ //void /*$*/freefunction/*$$*/() {
+ // return;
+ //}
+ //====================
+ //#include "A.h"
+ //
+
+ //A.h
+ //====================
+ //void freefunction() {
+ // return;
+ //}
+ public void testFreeFunctionFromImplToHeader() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //
+ //class A {
+ //public:
+ // void foo() {
+ // }
+ //
+ //private:
+ // int /*$*/x/*$$*/;
+ //};
+ public void testTestNotSupportedVariableSelection() throws Exception {
+ assertRefactoringFailure();
+ }
+
+ //A.h
+ //#include
+ //
+ //class A {
+ //public:
+ // void /*$*/foo/*$$*/();
+ //};
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ public void testTestNotSupportedNoDefinition() throws Exception {
+ assertRefactoringFailure();
+ }
+
+ //A.h
+ //#include
+ //
+ //class A {
+ //public:
+ // void /*$*/foo/*$$*/();
+ //};
+ public void testTestNotSupportedNoTranslationunit() throws Exception {
+ assertRefactoringFailure();
+ }
+
+ //A.h
+ //#include
+ //
+ //class A {
+ // void /*$*/foo/*$$*/();
+ // void foo();
+ //};
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ public void testTestMultipleDeclarations() throws Exception {
+ assertRefactoringFailure();
+ }
+
+ //A.h
+ //#include
+ //
+ //class A {
+ // void foo();
+ // void /*$*/foo/*$$*/() {
+ // return;
+ // }
+ //};
+ //
+ //void blah() {
+ //}
+ //
+ //inline void A::foo() {
+ // return;
+ //}
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ public void testTestMultipledefinitions() throws Exception {
+ assertRefactoringFailure();
+ }
+
+ //A.h
+ //class A {
+ // void foo() {
+ // void /*$*/bar/*$$*/() {
+ // }
+ // }
+ //};
+ public void testTestNotSupportedNestedFunctions() throws Exception {
+ assertRefactoringFailure();
+ }
+
+ //A.h
+ //class A {
+ // void me/*$*//*$$*/mber() {
+ // return;
+ // }
+ //};
+ //====================
+ //class A {
+ // void member();
+ //};
+ //
+ //inline void A::member() {
+ // return;
+ //}
+ public void testTestZeroLengthSelection() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class A {
+ // void m/*$*/e/*$$*/mber() {
+ // return;
+ // }
+ //};
+ //====================
+ //class A {
+ // void member();
+ //};
+ //
+ //inline void A::member() {
+ // return;
+ //}
+ public void testTestSubstringSelection() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class A {
+ // void member() {
+ // r/*$*//*$$*/eturn;
+ // }
+ //};
+ //====================
+ //class A {
+ // void member();
+ //};
+ //
+ //inline void A::member() {
+ // return;
+ //}
+ public void testTestBodySelection() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class A {
+ // void member() {
+ // int /*$*/abcd/*$$*/ = 42;
+ // return;
+ // }
+ //};
+ //====================
+ //class A {
+ // void member();
+ //};
+ //
+ //inline void A::member() {
+ // int abcd = 42;
+ // return;
+ //}
+ public void testTestBodySelectionWithConfusingName() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class A {
+ // /*$*//*$$*/void member() {
+ // return;
+ // }
+ //};
+ //====================
+ //class A {
+ // void member();
+ //};
+ //
+ //inline void A::member() {
+ // return;
+ //}
+ public void testTestLeftBorderSelection() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class A {
+ // void member() {
+ // return;
+ // }/*$*//*$$*/
+ //};
+ //====================
+ //class A {
+ // void member();
+ //};
+ //
+ //inline void A::member() {
+ // return;
+ //}
+ public void testTestRightBorderSelection() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class A {
+ // vo/*$*/id member() {
+ // ret/*$$*/urn;
+ // }
+ //};
+ //====================
+ //class A {
+ // void member();
+ //};
+ //
+ //inline void A::member() {
+ // return;
+ //}
+ public void testTestOverlappingSelection() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //
+ //class A {
+ //public:
+ // int /*$*/function/*$$*/() {
+ // return 0;
+ // }
+ //
+ //private:
+ // int a;
+ //};
+ //====================
+ //#include
+ //
+ //class A {
+ //public:
+ // int function();
+ //
+ //private:
+ // int a;
+ //};
+ //
+ //inline int A::function() {
+ // return 0;
+ //}
+ public void testTestSimpleFunctionInClassToInHeader() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //
+ //class A {
+ //public:
+ // int function();
+ //
+ //private:
+ // int a;
+ //};
+ //
+ //inline int A::/*$*/function/*$$*/() {
+ // return 0;
+ //}
+ //====================
+ //#include
+ //
+ //class A {
+ //public:
+ // int function();
+ //
+ //private:
+ // int a;
+ //};
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //
+ //int A::function() {
+ // return 0;
+ //}
+ public void testTestSimpleFunctionInHeaderToImplementation() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int A::/*$*/function/*$$*/() {
+ // return 0;
+ //}
+ //
+ //int main() {
+ // return 0;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+
+ //A.h
+ //#include
+ //
+ //class A {
+ //public:
+ // int function();
+ //
+ //private:
+ // int a;
+ //};
+ //====================
+ //#include
+ //
+ //class A {
+ //public:
+ // int function() {
+ // return 0;
+ // }
+ //
+ //private:
+ // int a;
+ //};
+ public void testTestSimpleFunctionInImplementationToInClass() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //MyClass.cpp
+ //#include "MyClass.h"
+ //
+ //myClass::/*$*/myClass/*$$*/(int implname) :
+ // fVal(implname) {
+ //}
+ //
+ //int main() {
+ // return 0;
+ //}
+ //====================
+ //#include "MyClass.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+
+ //MyClass.h
+ //
+ //struct myClass {
+ // int fVal;
+ // myClass(int headername);
+ //};
+ //====================
+ //
+ //struct myClass {
+ // int fVal;
+ // myClass(int implname) :
+ // fVal(implname) {
+ // }
+ //};
+ public void testTestDifferentParameterNames() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //MyClass.cpp
+ //#include "MyClass.h"
+ //
+ //myClass::/*$*/myClass/*$$*/(int implname) :
+ // fVal(implname) {
+ //}
+ //
+ //int main() {
+ // return 0;
+ //}
+ //====================
+ //#include "MyClass.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+
+ //MyClass.h
+ //struct myClass {
+ // int fVal;
+ // myClass(int);
+ //};
+ //====================
+ //struct myClass {
+ // int fVal;
+ // myClass(int implname) :
+ // fVal(implname) {
+ // }
+ //};
+ public void testTestMissingParameterNames() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //
+ //template
+ //class A {
+ // class B {
+ // T /*$*/member/*$$*/() {
+ // return T();
+ // }
+ // };
+ //};
+ //====================
+ //#include
+ //
+ //template
+ //class A {
+ // class B {
+ // T member();
+ // };
+ //};
+ //
+ //template
+ //inline T A::B::member() {
+ // return T();
+ //}
+ public void testTestTemplateFunctionInClassToInHeader() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //
+ //template
+ //class A {
+ // class B {
+ // T member();
+ // };
+ //};
+ //
+ //template
+ //inline T A::B::/*$*/member/*$$*/() {
+ // return T();
+ //}
+ //====================
+ //#include
+ //
+ //template
+ //class A {
+ // class B {
+ // T member() {
+ // return T();
+ // }
+ // };
+ //};
+ public void testTestTemplateFunctionInHeaderToInClass() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //class A {
+ // tem/*$*/plate/*$$*/
+ // T foo() {
+ // return T();
+ // }
+ //};
+ //====================
+ //class A {
+ // template
+ // T foo();
+ //};
+ //
+ //template
+ //inline T A::foo() {
+ // return T();
+ //}
+ public void testTestTemplateFunctionInHeaderToInClassWithTemplateSelected() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //template
+ //class A {
+ //public:
+ // template
+ // void /*$*/foo/*$$*/(const U& u, const V& v) {
+ // return;
+ // }
+ //};
+ //====================
+ //template
+ //class A {
+ //public:
+ // template
+ // void foo(const U& u, const V& v);
+ //};
+ //
+ //template
+ //template
+ //inline void A::foo(const U& u, const V& v) {
+ // return;
+ //}
+ public void testTestComplexTemplateFunctionFromInClassToInHeader() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //template
+ //class A {
+ //public:
+ // template
+ // void /*$*/foo/*$$*/(const U& u, const V& v);
+ //};
+ //
+ //template
+ //template
+ //inline void A::foo(const U& u, const V& v) {
+ // return;
+ //}
+ //====================
+ //template
+ //class A {
+ //public:
+ // template
+ // void foo(const U& u, const V& v) {
+ // return;
+ // }
+ //};
+ public void testTestComplexTemplateFunctionFromInHeaderToInClass() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void /*$*/foo/*$$*/() {
+ // return;
+ // }
+ //};
+ //
+ //}
+ //====================
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //inline void A::foo() {
+ // return;
+ //}
+ //
+ //}
+ public void testTestSimpleNamespaceInClassToInHeader() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //inline void A::/*$*/foo/*$$*/() {
+ // return;
+ //}
+ //
+ //}
+ //====================
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //}
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //
+ //namespace N {
+ //
+ //void A::foo() {
+ // return;
+ //}
+ //
+ //}
+ public void testTestSimpleNamespaceInHeaderToImplementationWithinNamespaceDefinition() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //inline void A::/*$*/foo/*$$*/() {
+ // return;
+ //}
+ //
+ //}
+ //====================
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //}
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //
+ //namespace N {
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //
+ //namespace N {
+ //
+ //void A::foo() {
+ // return;
+ //}
+ //
+ //}
+ public void testTestSimpleNamespaceInHeaderToImplementationWithNamespaceDefinitionInImplementation() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //}
+ //
+ //inline void /*$*/N::A::foo/*$$*/() {
+ // return;
+ //}
+ //====================
+ //#include
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //}
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+ //
+ //namespace N {
+ //
+ //void A::foo() {
+ // return;
+ //}
+ //
+ //}
+ public void testTestSimpleNamespaceInHeaderToImplementationWithNamespaceQualifiedName() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //void /*$*/N::A::foo/*$$*/() {
+ // return;
+ //}
+ //
+ //int main() {
+ // return 0;
+ //}
+ //====================
+ //#include "A.h"
+ //
+ //int main() {
+ // return 0;
+ //}
+
+ //A.h
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //}
+ //====================
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo() {
+ // return;
+ // }
+ //};
+ //
+ //}
+ public void testTestSimpleNamespaceFromImplementationToInHeader() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.cpp
+ //#include "A.h"
+ //
+ //namespace N {
+ //
+ //void /*$*/A::foo/*$$*/() {
+ // return;
+ //}
+ //
+ //}
+ //====================
+ //#include "A.h"
+
+ //A.h
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo();
+ //};
+ //
+ //}
+ //====================
+ //#include
+ //
+ //namespace N {
+ //
+ //class A {
+ // void foo() {
+ // return;
+ // }
+ //};
+ //
+ //}
+ public void testTestRemoveEmptyNamespaceFromImplentation() throws Exception {
+ assertRefactoringSuccess();
+ }
+
+ //A.h
+ //#include
+ //#include
+ //
+ //class A {
+ // void /*$*/member/*$$*/(int a, int b)
+ // try {
+ // return;
+ // }
+ // catch (std::exception& e1){
+ // return;
+ // }
+ //};
+ //====================
+ //#include