mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Converted Hide Method refactoring test to the new framework.
This commit is contained in:
parent
546389bc1e
commit
3d474b9327
6 changed files with 1491 additions and 1525 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,45 +0,0 @@
|
|||
//!HideMethodSimple
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
|
||||
//@A.h
|
||||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
void method2();
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
int i;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
//=
|
||||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
int i;
|
||||
|
||||
void method2();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
//@refScript.xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<session version="1.0">
|
||||
<refactoring comment="Hide Method method2" description="Hide Method Refactoring"
|
||||
fileName="file:$$projectPath$$/A.h" flags="2"
|
||||
id="org.eclipse.cdt.internal.ui.refactoring.hidemethod.HideMethodRefactoring"
|
||||
project="RegressionTestProject" selection="78,7"/>
|
||||
</session>
|
|
@ -59,8 +59,16 @@ public abstract class RefactoringTestBase extends BaseTestCase {
|
|||
private static final int INDEXER_TIMEOUT_SEC = 360;
|
||||
protected static final NullProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
|
||||
|
||||
/** Allows empty files to be created during test setup. */
|
||||
protected boolean createEmptyFiles = true;
|
||||
/** See {@link PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER} */
|
||||
protected boolean ascendingVisibilityOrder;
|
||||
/** Expected counts of errors, warnings and info messages */
|
||||
protected int expectedInitialErrors;
|
||||
protected int expectedInitialWarnings;
|
||||
protected int expectedFinalWarnings;
|
||||
protected int expectedFinalInfos;
|
||||
|
||||
private boolean cpp = true;
|
||||
private ICProject cproject;
|
||||
private final Set<TestSourceFile> testFiles = new LinkedHashSet<TestSourceFile>();
|
||||
|
@ -170,12 +178,24 @@ public abstract class RefactoringTestBase extends BaseTestCase {
|
|||
assertStatusFatalError(initialStatus);
|
||||
return;
|
||||
}
|
||||
if (expectedInitialErrors != 0) {
|
||||
assertStatusError(initialStatus, expectedInitialErrors);
|
||||
} else if (expectedInitialWarnings != 0) {
|
||||
assertStatusWarning(initialStatus, expectedInitialWarnings);
|
||||
} else {
|
||||
assertStatusOk(initialStatus);
|
||||
}
|
||||
|
||||
assertStatusOk(initialStatus);
|
||||
if (withUserInput)
|
||||
simulateUserInput();
|
||||
RefactoringStatus finalStatus = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
|
||||
assertStatusOk(finalStatus);
|
||||
if (expectedFinalWarnings != 0) {
|
||||
assertStatusWarning(finalStatus, expectedFinalWarnings);
|
||||
} else if (expectedFinalInfos != 0) {
|
||||
assertStatusInfo(finalStatus, expectedFinalInfos);
|
||||
} else {
|
||||
assertStatusOk(finalStatus);
|
||||
}
|
||||
Change change = refactoring.createChange(NULL_PROGRESS_MONITOR);
|
||||
change.perform(NULL_PROGRESS_MONITOR);
|
||||
} finally {
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefac
|
|||
import org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest;
|
||||
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.HideMethodTestSuite;
|
||||
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.rename.RenameRegressionTests;
|
||||
import org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToogleRefactoringTest;
|
||||
|
@ -37,7 +37,7 @@ public class RefactoringTestSuite extends TestSuite {
|
|||
suite.addTest(RenameRegressionTests.suite());
|
||||
suite.addTest(ExtractFunctionRefactoringTest.suite());
|
||||
suite.addTest(ExtractConstantRefactoringTest.suite());
|
||||
suite.addTest(HideMethodTestSuite.suite());
|
||||
suite.addTest(HideMethodRefactoringTest.suite());
|
||||
suite.addTest(GenerateGettersAndSettersTest.suite());
|
||||
suite.addTest(ImplementMethodTestSuite.suite());
|
||||
suite.addTest(ExtractLocalVariableRefactoringTest.suite());
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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.hidemethod;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTester;
|
||||
|
||||
/**
|
||||
* Test suite to run just the Hide Method unit tests.
|
||||
*
|
||||
* @author Tom Ball
|
||||
*/
|
||||
public class HideMethodTestSuite extends TestSuite {
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new HideMethodTestSuite();
|
||||
suite.addTest(RefactoringTester.suite("HideMethodRefactoringTests",
|
||||
"resources/refactoring/HideMethod.rts"));
|
||||
suite.addTest(RefactoringTester.suite("HideMethodRefactoringHistoryTests",
|
||||
"resources/refactoring/HideMethodHistory.rts"));
|
||||
return suite;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue