1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Converted Implement Method refactoring tests to the new framework.

This commit is contained in:
Sergey Prigogin 2012-02-15 19:03:41 -08:00
parent 3d474b9327
commit 183fe7ba62
5 changed files with 767 additions and 825 deletions

View file

@ -1,765 +0,0 @@
//!Param const and reference and pointer
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
class X {
public:
bool /*$*/a(int = 100)/*$$*/ const;
};
//=
class X {
public:
bool a(int = 100) const;
};
inline bool X::a(int int1) const {
}
//!Param const and reference and pointer two params
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
class X {
public:
bool /*$*/xy(int, int i)/*$$*/ const;
};
//=
class X {
public:
bool xy(int, int i) const;
};
inline bool X::xy(int int1, int i) const {
}
//!Test if TemplateMethod stays in header
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
template<class T>
class A {
public:
/*$*/void test();/*$$*/
};
//=
template<class T>
class A {
public:
void test();
};
template<class T>
inline void A<T>::test() {
}
//@A.cpp
#include "A.h"
//=
#include "A.h"
//!Class template member functions
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
template<class T>
class A {
public:
A();
/*$*/void test();/*$$*/
};
template<class T>
A<T>::A() {
}
//=
template<class T>
class A {
public:
A();
void test();
};
template<class T>
A<T>::A() {
}
template<class T>
inline void A<T>::test() {
}
//!Member class
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class Demo {
class SubClass {
/*$*/void test();/*$$*/
};
};
//@A.cpp
#include "A.h"
//=
#include "A.h"
void Demo::SubClass::test() {
}
//!Method declared in otherwise empty class without cpp file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
class A {
public:
/*$*/void test();/*$$*/
};
//=
class A {
public:
void test();
};
inline void A::test() {
}
//!Method declared in otherwise empty class
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
public:
/*$*/void test();/*$$*/
};
//=
class A {
public:
void test();
};
//@A.cpp
//=
void A::test() {
}
//!Implement in existing namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
namespace Namespace {
class ClassInNamespace {
public:
int test();
/*$*/void test2();/*$$*/
};
}
//@A.cpp
#include "A.h"
namespace Namespace {
int ClassInNamespace::test() {
return 5;
}
}
//=
#include "A.h"
namespace Namespace {
int ClassInNamespace::test() {
return 5;
}
void ClassInNamespace::test2() {
}
}
//!Virtual method in the middle of con/destructor, without parameters and void return value
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
/*$*/virtual void foo();/*$$*/
~A();
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
}
//=
#include "A.h"
A::A() {
}
void A::foo() {
}
A::~A() {
}
//!Implement a function at start of source file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
/*$*/void function();/*$$*/
void function_with_impl();
//@A.cpp
void function_with_impl() {
}
//=
void function() {
}
void function_with_impl() {
}
//!Method at end, without parameters and void return value
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
/*$*/void foo();/*$$*/
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
//=
#include "A.h"
A::A() {
}
void A::foo() {
}
//!Method at beginning, without parameters, void return value and const
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
/*$*/void foo() const;/*$$*/
A();
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
//=
#include "A.h"
void A::foo() const {
}
A::A() {
}
//!Method with int return value
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
/*$*/int foo();/*$$*/
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
//=
#include "A.h"
A::A() {
}
int A::foo() {
}
//!Method with two int parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
/*$*/int foo(int param1, int param2);/*$$*/
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
//=
#include "A.h"
A::A() {
}
int A::foo(int param1, int param2) {
}
//!Method defined in header
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
class A {
public:
A();
/*$*/void test();/*$$*/
};
A::A() {
}
//=
class A {
public:
A();
void test();
};
A::A() {
}
inline void A::test() {
}
//!Implement a function at end of source file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
void function_with_impl();
/*$*/void function();/*$$*/
//@A.cpp
void function_with_impl() {
}
//=
void function_with_impl() {
}
void function() {
}
//!Implement with namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
namespace Namespace {
class ClassInNamespace {
public:
int other_test();
/*$*/void test();/*$$*/
};
}
//@A.cpp
#include "A.h"
void Namespace::ClassInNamespace::other_test() {
}
//=
#include "A.h"
void Namespace::ClassInNamespace::other_test() {
}
void Namespace::ClassInNamespace::test() {
}
//!Implement function within namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
namespace OuterSpace {
namespace Namespace {
int test();
/*$*/int test2();/*$$*/
}
}
//@A.cpp
#include "A.h"
namespace OuterSpace {
int Namespace::test() {
}
}
//=
#include "A.h"
namespace OuterSpace {
int Namespace::test() {
}
int Namespace::test2() {
}
}
//!Implement function within namespaces
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
namespace OuterSpace {
namespace Namespace {
int test();
/*$*/int test2();/*$$*/
}
}
//@A.cpp
#include "A.h"
namespace OuterSpace {
namespace Namespace {
int test() {
}
}
}
//=
#include "A.h"
namespace OuterSpace {
namespace Namespace {
int test() {
}
int test2() {
}
}
}
//!Class template member functions with multiple templates
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
template<class T, class U>
class A {
public:
A();
/*$*/void test();/*$$*/
};
template<class T, class U>
A<T, U>::A() {
}
//=
template<class T, class U>
class A {
public:
A();
void test();
};
template<class T, class U>
A<T, U>::A() {
}
template<class T, class U>
inline void A<T, U>::test() {
}
//!With default parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class Class {
public:
/*$*/void test(int param1, int param2 = 5, int param3 = 10);/*$$*/
};
//@A.cpp
#include "A.h"
//=
#include "A.h"
void Class::test(int param1, int param2, int param3) {
}
//!Static method
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class Class {
public:
/*$*/static void test();/*$$*/
};
//@A.cpp
#include "A.h"
//=
#include "A.h"
void Class::test() {
}
//! Bug 238253 Pointer refence of the return value lost
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class TestClass {
public:
/*$*/int* get(char* val);/*$$*/
};
//@A.cpp
#include "A.h"
//=
#include "A.h"
int* TestClass::get(char* val) {
}
//! Bug 238554 void parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class Test {
public:
/*$*/void doNothing(void);/*$$*/
};
//@A.cpp
#include "A.h"
//=
#include "A.h"
void Test::doNothing(void) {
}
//! Bug 282989 Refactor->Implement method option doesn't qualify the name in the method definition with a fully qualified container class name
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=TestClass.h
infos=1
//@TestClass.h
#ifndef TESTCLASS_H_
#define TESTCLASS_H_
namespace nspace {
class TestClass {
void /*$*/testMethod()/*$$*/;
};
}
#endif /* TESTCLASS_H_ */
//=
#ifndef TESTCLASS_H_
#define TESTCLASS_H_
namespace nspace {
class TestClass {
void testMethod();
};
}
inline void nspace::TestClass::testMethod() {
}
#endif /* TESTCLASS_H_ */
//!Bug 290110 Source-> Implement Method
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
#ifndef A_H_
#define A_H_
namespace n1 {
namespace n2 {
class A {
public:
A();
~A();
void testmethod(int x);
protected:
class B {
public:
void /*$*/testmethod2()/*$$*/;
};
};
}
}
#endif /* A_H_ */
//@A.cpp
#include "A.h"
namespace n1 {
namespace n2 {
A::A() {
}
A::~A() {
}
}
}
//=
#include "A.h"
namespace n1 {
namespace n2 {
A::A() {
}
A::~A() {
}
}
}
void n1::n2::A::B::testmethod2() {
}
//!Bug 337040 - Insert definition in empty implementation file (.cxx)
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class TestClass {
public:
/*$*/void foo();/*$$*/
};
//@A.cxx
//=
void TestClass::foo() {
}
//!Bug 355006 - NPE implementing template function
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
/*$*/template<typename T>
void func(T&);/*$$*/
//=
template<typename T>
void func(T&);
template<typename T>
inline void func(T&) {
}
//!Bug 363111 - Remove explicit in constructor definition
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
class TestClass {
public:
/*$*/explicit TestClass();/*$$*/
};
//@A.cpp
//=
TestClass::TestClass() {
}

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefac
import org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest;
import org.eclipse.cdt.ui.tests.refactoring.hidemethod.HideMethodRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodTestSuite;
import org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.rename.RenameRegressionTests;
import org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToogleRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.utils.UtilTestSuite;
@ -39,7 +39,7 @@ public class RefactoringTestSuite extends TestSuite {
suite.addTest(ExtractConstantRefactoringTest.suite());
suite.addTest(HideMethodRefactoringTest.suite());
suite.addTest(GenerateGettersAndSettersTest.suite());
suite.addTest(ImplementMethodTestSuite.suite());
suite.addTest(ImplementMethodRefactoringTest.suite());
suite.addTest(ExtractLocalVariableRefactoringTest.suite());
suite.addTest(ToogleRefactoringTest.suite());
return suite;

View file

@ -8,46 +8,785 @@
*
* Contributors:
* Institute for Software - initial API and implementation
* Marc-Andre Laperle
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.implementmethod;
import java.util.Collection;
import java.util.Properties;
import junit.framework.Test;
import org.eclipse.core.resources.IFile;
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.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.CRefactoring2;
import org.eclipse.cdt.internal.ui.refactoring.implementmethod.ImplementMethodRefactoring;
/**
* @author Mirko Stocker
* Tests for Extract Local Variable refactoring.
*/
public class ImplementMethodRefactoringTest extends RefactoringTest {
public class ImplementMethodRefactoringTest extends RefactoringTestBase {
public ImplementMethodRefactoringTest(String name, Collection<TestSourceFile> files) {
super(name, files);
public ImplementMethodRefactoringTest() {
super();
}
public ImplementMethodRefactoringTest(String name) {
super(name);
}
public static Test suite() {
return suite(ImplementMethodRefactoringTest.class);
}
@Override
protected void runTest() throws Throwable {
IFile refFile = project.getFile(fileName);
ICElement element = CoreModel.getDefault().create(refFile);
CRefactoring2 refactoring = new ImplementMethodRefactoring(element, selection, cproject);
executeRefactoring(refactoring);
compareFiles(fileMap);
protected Refactoring createRefactoring() {
return new ImplementMethodRefactoring(getSelectedTranslationUnit(), getSelection(),
getCProject());
}
@Override
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$
finalInfos = Integer.parseInt(refactoringProperties.getProperty("infos", "0")); //$NON-NLS-1$//$NON-NLS-2$
//A.h
//class X {
//public:
// bool /*$*/a(int = 100)/*$$*/ const;
//};
//====================
//class X {
//public:
// bool a(int = 100) const;
//};
//
//inline bool X::a(int int1) const {
//}
public void testParameterWithDefaultValue() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//class X {
//public:
// bool /*$*/xy(int, int i)/*$$*/ const;
//};
//====================
//class X {
//public:
// bool xy(int, int i) const;
//};
//
//inline bool X::xy(int int1, int i) const {
//}
public void testConstMethod() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//template<class T>
//class A {
//public:
// /*$*/void test();/*$$*/
//};
//====================
//template<class T>
//class A {
//public:
// void test();
//};
//
//template<class T>
//inline void A<T>::test() {
//}
//A.cpp
//#include "A.h"
//====================
//#include "A.h"
public void testTestIfTemplateMethodStaysInHeader() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//template<class T>
//class A {
//public:
// A();
// /*$*/void test();/*$$*/
//};
//
//template<class T>
//A<T>::A() {
//}
//====================
//template<class T>
//class A {
//public:
// A();
// void test();
//};
//
//template<class T>
//A<T>::A() {
//}
//
//template<class T>
//inline void A<T>::test() {
//}
public void testClassTemplateMemberFunctions() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//
//class Demo {
// class SubClass {
// /*$*/void test();/*$$*/
// };
//};
//
//A.cpp
//#include "A.h"
//====================
//#include "A.h"
//
//void Demo::SubClass::test() {
//}
public void testMemberClass() throws Exception {
assertRefactoringSuccess();
}
//A.h
//class A {
//public:
// /*$*/void test();/*$$*/
//};
//====================
//class A {
//public:
// void test();
//};
//
//inline void A::test() {
//}
public void testNoImplementationFile() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//class A {
//public:
// /*$*/void test();/*$$*/
//};
//====================
//class A {
//public:
// void test();
//};
//A.cpp
//====================
//void A::test() {
//}
public void testDeclaredInOtherwiseEmptyClass() throws Exception {
assertRefactoringSuccess();
}
//A.h
//namespace Namespace {
//
//class ClassInNamespace {
//public:
// int test();
// /*$*/void test2();/*$$*/
//};
//
//}
//A.cpp
//#include "A.h"
//
//namespace Namespace {
//
//int ClassInNamespace::test() {
// return 5;
//}
//
//}
//====================
//#include "A.h"
//
//namespace Namespace {
//
//int ClassInNamespace::test() {
// return 5;
//}
//
//void ClassInNamespace::test2() {
//}
//
//}
public void testExistingNamespace() throws Exception {
assertRefactoringSuccess();
}
//A.h
//#ifndef A_H_
//#define A_H_
//
//class A {
//public:
// A();
// /*$*/virtual void foo();/*$$*/
// ~A();
//};
//
//#endif /*A_H_*/
//A.cpp
//#include "A.h"
//
//A::A() {
//}
//
//A::~A() {
//}
//====================
//#include "A.h"
//
//A::A() {
//}
//
//void A::foo() {
//}
//
//A::~A() {
//}
public void testVirtualMethodBetweenCtorAndDtor() throws Exception {
assertRefactoringSuccess();
}
//A.h
///*$*/void function();/*$$*/
//void function_with_impl();
//A.cpp
//void function_with_impl() {
//}
//====================
//void function() {
//}
//
//void function_with_impl() {
//}
public void testFunctionAtStartOfSourceFile() throws Exception {
assertRefactoringSuccess();
}
//A.h
//#ifndef A_H_
//#define A_H_
//
//class A {
//public:
// A();
// /*$*/void foo();/*$$*/
//};
//
//#endif /*A_H_*/
//A.cpp
//#include "A.h"
//
//A::A() {
//}
//====================
//#include "A.h"
//
//A::A() {
//}
//
//void A::foo() {
//}
public void testLastMethodInClass() throws Exception {
assertRefactoringSuccess();
}
//A.h
//#ifndef A_H_
//#define A_H_
//
//class A {
//public:
// /*$*/void foo() const;/*$$*/
// A();
//};
//
//#endif /*A_H_*/
//A.cpp
//#include "A.h"
//
//A::A() {
//}
//====================
//#include "A.h"
//
//void A::foo() const {
//}
//
//A::A() {
//}
public void testFirstMethodInClass() throws Exception {
assertRefactoringSuccess();
}
//A.h
//#ifndef A_H_
//#define A_H_
//
//class A {
//public:
// A();
// /*$*/int foo();/*$$*/
//};
//
//#endif /*A_H_*/
//A.cpp
//#include "A.h"
//
//A::A() {
//}
//====================
//#include "A.h"
//
//A::A() {
//}
//
//int A::foo() {
//}
public void testWithIntReturnValue() throws Exception {
assertRefactoringSuccess();
}
//A.h
//#ifndef A_H_
//#define A_H_
//
//class A {
//public:
// A();
// /*$*/int foo(int param1, int param2);/*$$*/
//};
//
//#endif /*A_H_*/
//A.cpp
//#include "A.h"
//
//A::A() {
//}
//====================
//#include "A.h"
//
//A::A() {
//}
//
//int A::foo(int param1, int param2) {
//}
public void testWithTwoIntParameters() throws Exception {
assertRefactoringSuccess();
}
//A.h
//class A {
//public:
// A();
// /*$*/void test();/*$$*/
//};
//
//A::A() {
//}
//====================
//class A {
//public:
// A();
// void test();
//};
//
//A::A() {
//}
//
//inline void A::test() {
//}
public void testDefinedInHeader() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//void function_with_impl();
///*$*/void function();/*$$*/
//A.cpp
//void function_with_impl() {
//}
//====================
//void function_with_impl() {
//}
//
//void function() {
//}
public void testFunctionAtEndOfSourceFile() throws Exception {
assertRefactoringSuccess();
}
//A.h
//namespace Namespace {
//
//class ClassInNamespace {
//public:
// int other_test();
// /*$*/void test();/*$$*/
//};
//
//}
//A.cpp
//#include "A.h"
//void Namespace::ClassInNamespace::other_test() {
//}
//====================
//#include "A.h"
//void Namespace::ClassInNamespace::other_test() {
//}
//
//void Namespace::ClassInNamespace::test() {
//}
public void testNamespace() throws Exception {
assertRefactoringSuccess();
}
//A.h
//namespace OuterSpace {
//namespace Namespace {
//
//int test();
///*$*/int test2();/*$$*/
//
//}
//}
//A.cpp
//#include "A.h"
//namespace OuterSpace {
//
//int Namespace::test() {
//}
//
//}
//====================
//#include "A.h"
//namespace OuterSpace {
//
//int Namespace::test() {
//}
//
//int Namespace::test2() {
//}
//
//}
public void testFunctionWithinNamespace() throws Exception {
assertRefactoringSuccess();
}
//A.h
//namespace OuterSpace {
//namespace Namespace {
//
//int test();
///*$*/int test2();/*$$*/
//
//}
//}
//A.cpp
//#include "A.h"
//namespace OuterSpace {
//namespace Namespace {
//
//int test() {
//}
//
//}
//}
//====================
//#include "A.h"
//namespace OuterSpace {
//namespace Namespace {
//
//int test() {
//}
//
//int test2() {
//}
//
//}
//}
public void testFunctionWithinNamespaces() throws Exception {
assertRefactoringSuccess();
}
//A.h
//template<class T, class U>
//class A {
//public:
// A();
// /*$*/void test();/*$$*/
//};
//
//template<class T, class U>
//A<T, U>::A() {
//}
//====================
//template<class T, class U>
//class A {
//public:
// A();
// void test();
//};
//
//template<class T, class U>
//A<T, U>::A() {
//}
//
//template<class T, class U>
//inline void A<T, U>::test() {
//}
public void testMethodOfTemplateClass() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//
//class Class {
//public:
// /*$*/void test(int param1, int param2 = 5, int param3 = 10);/*$$*/
//};
//
//A.cpp
//#include "A.h"
//====================
//#include "A.h"
//
//void Class::test(int param1, int param2, int param3) {
//}
public void testWithDefaultParameters() throws Exception {
assertRefactoringSuccess();
}
//A.h
//
//class Class {
//public:
// /*$*/static void test();/*$$*/
//};
//
//A.cpp
//#include "A.h"
//====================
//#include "A.h"
//
//void Class::test() {
//}
public void testStaticMethod() throws Exception {
assertRefactoringSuccess();
}
//A.h
//
//class TestClass {
//public:
// /*$*/int* get(char* val);/*$$*/
//};
//
//A.cpp
//#include "A.h"
//====================
//#include "A.h"
//
//int* TestClass::get(char* val) {
//}
public void testPointerReturnValue_Bug238253() throws Exception {
assertRefactoringSuccess();
}
//A.h
//
//class Test {
//public:
// /*$*/void doNothing(void);/*$$*/
//};
//
//A.cpp
//#include "A.h"
//====================
//#include "A.h"
//
//void Test::doNothing(void) {
//}
public void testVoidParameter_Bug238554() throws Exception {
assertRefactoringSuccess();
}
//TestClass.h
//#ifndef TESTCLASS_H_
//#define TESTCLASS_H_
//
//namespace nspace {
//
//class TestClass {
// void /*$*/testMethod()/*$$*/;
//};
//
//}
//
//#endif /* TESTCLASS_H_ */
//====================
//#ifndef TESTCLASS_H_
//#define TESTCLASS_H_
//
//namespace nspace {
//
//class TestClass {
// void testMethod();
//};
//
//}
//
//inline void nspace::TestClass::testMethod() {
//}
//
//#endif /* TESTCLASS_H_ */
public void testNameQualification_Bug282989() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//#ifndef A_H_
//#define A_H_
//
//namespace n1 {
//namespace n2 {
//
//class A {
//public:
// A();
// ~A();
// void testmethod(int x);
//
//protected:
// class B {
// public:
// void /*$*/testmethod2()/*$$*/;
// };
//};
//
//}
//}
//
//
//#endif /* A_H_ */
//A.cpp
//#include "A.h"
//
//namespace n1 {
//namespace n2 {
//
//A::A() {
//}
//
//A::~A() {
//}
//
//}
//}
//====================
//#include "A.h"
//
//namespace n1 {
//namespace n2 {
//
//A::A() {
//}
//
//A::~A() {
//}
//
//}
//}
//
//void n1::n2::A::B::testmethod2() {
//}
public void testNestedClass_Bug290110() throws Exception {
assertRefactoringSuccess();
}
//A.h
//
//class TestClass {
//public:
// /*$*/void foo();/*$$*/
//};
//
//A.cxx
//====================
//void TestClass::foo() {
//}
public void testEmptyImplementationFile_Bug337040() throws Exception {
assertRefactoringSuccess();
}
//A.h
//
///*$*/template<typename T>
//void func(T&);/*$$*/
//====================
//
//template<typename T>
//void func(T&);
//
//template<typename T>
//inline void func(T&) {
//}
public void testTemplateFunction_Bug355006() throws Exception {
expectedFinalInfos = 1;
assertRefactoringSuccess();
}
//A.h
//
//class TestClass {
//public:
// /*$*/explicit TestClass();/*$$*/
//};
//
//A.cpp
//====================
//TestClass::TestClass() {
//}
public void testExplicitConstructor_Bug363111() throws Exception {
assertRefactoringSuccess();
}
}

View file

@ -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 - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.implementmethod;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTester;
/**
* Test suite to run just the Implement Method unit tests.
*
* @author Tom Ball
*/
public class ImplementMethodTestSuite extends TestSuite {
@SuppressWarnings("nls")
public static Test suite() throws Exception {
TestSuite suite = new ImplementMethodTestSuite();
suite.addTest(RefactoringTester.suite("ImplementMethodRefactoringTest",
"resources/refactoring/ImplementMethod.rts"));
return suite;
}
}