mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Add CreateLocalVariableQuickFix test to automated tests suite, fix the test. Minor clean up.
This commit is contained in:
parent
d9f24fae67
commit
cbd551eeef
3 changed files with 26 additions and 8 deletions
|
@ -14,7 +14,6 @@ import org.eclipse.cdt.codan.core.test.CheckerTestCase;
|
||||||
import org.eclipse.cdt.codan.internal.checkers.ProblemBindingChecker;
|
import org.eclipse.cdt.codan.internal.checkers.ProblemBindingChecker;
|
||||||
|
|
||||||
public class ProblemBindingCheckerTest extends CheckerTestCase {
|
public class ProblemBindingCheckerTest extends CheckerTestCase {
|
||||||
// @Override
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCpp() {
|
public boolean isCpp() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.codan.core.internal.checkers.ReturnStyleCheckerTest;
|
||||||
import org.eclipse.cdt.codan.core.internal.checkers.StatementHasNoEffectCheckerTest;
|
import org.eclipse.cdt.codan.core.internal.checkers.StatementHasNoEffectCheckerTest;
|
||||||
import org.eclipse.cdt.codan.core.internal.checkers.SuggestedParenthesisCheckerTest;
|
import org.eclipse.cdt.codan.core.internal.checkers.SuggestedParenthesisCheckerTest;
|
||||||
import org.eclipse.cdt.codan.core.internal.checkers.SuspiciousSemicolonCheckerTest;
|
import org.eclipse.cdt.codan.core.internal.checkers.SuspiciousSemicolonCheckerTest;
|
||||||
|
import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.CreateLocalVariableQuickFixTest;
|
||||||
import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.SuggestedParenthesisQuickFixTest;
|
import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.SuggestedParenthesisQuickFixTest;
|
||||||
|
|
||||||
public class AutomatedIntegrationSuite extends TestSuite {
|
public class AutomatedIntegrationSuite extends TestSuite {
|
||||||
|
@ -62,6 +63,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
||||||
suite.addTest(CodanFastTestSuite.suite());
|
suite.addTest(CodanFastTestSuite.suite());
|
||||||
// quick fixes
|
// quick fixes
|
||||||
suite.addTestSuite(SuggestedParenthesisQuickFixTest.class);
|
suite.addTestSuite(SuggestedParenthesisQuickFixTest.class);
|
||||||
|
suite.addTestSuite(CreateLocalVariableQuickFixTest.class);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Tomasz Wesolowski and others
|
* Copyright (c) 2010, 2011 Tomasz Wesolowski and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
|
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.codan.internal.checkers.ProblemBindingChecker;
|
||||||
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
|
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,14 +23,30 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
||||||
return new QuickFixCreateLocalVariable();
|
return new QuickFixCreateLocalVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCpp() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.codan.core.test.CodanTestCase#setUp()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
enableProblems(ProblemBindingChecker.ERR_ID_FieldResolutionProblem, ProblemBindingChecker.ERR_ID_MethodResolutionProblem,
|
||||||
|
ProblemBindingChecker.ERR_ID_VariableResolutionProblem);
|
||||||
|
}
|
||||||
|
|
||||||
// void func() {
|
// void func() {
|
||||||
// aChar = 'a';
|
// aChar = 'a';
|
||||||
// }
|
// }
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public void testChar() {
|
public void testChar() {
|
||||||
loadcode(getAboveComment());
|
loadcode(getAboveComment());
|
||||||
String result = runQuickFixOneFile();
|
String result = runQuickFixOneFile();
|
||||||
assertContainedIn("char aChar;", result);
|
assertContainedIn("char aChar;", result); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// void func() {
|
// void func() {
|
||||||
|
@ -38,7 +55,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
||||||
public void testDouble() {
|
public void testDouble() {
|
||||||
loadcode(getAboveComment());
|
loadcode(getAboveComment());
|
||||||
String result = runQuickFixOneFile();
|
String result = runQuickFixOneFile();
|
||||||
assertContainedIn("double aDouble;", result);
|
assertContainedIn("double aDouble;", result); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// void func() {
|
// void func() {
|
||||||
|
@ -47,7 +64,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
||||||
public void testString() {
|
public void testString() {
|
||||||
loadcode(getAboveComment());
|
loadcode(getAboveComment());
|
||||||
String result = runQuickFixOneFile();
|
String result = runQuickFixOneFile();
|
||||||
assertContainedIn("const char *aString;", result);
|
assertContainedIn("const char *aString;", result); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// void func() {
|
// void func() {
|
||||||
|
@ -56,7 +73,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
||||||
public void testWString() {
|
public void testWString() {
|
||||||
loadcode(getAboveComment());
|
loadcode(getAboveComment());
|
||||||
String result = runQuickFixOneFile();
|
String result = runQuickFixOneFile();
|
||||||
assertContainedIn("const wchar_t *aWString;", result);
|
assertContainedIn("const wchar_t *aWString;", result); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// void func() {
|
// void func() {
|
||||||
|
@ -65,6 +82,6 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
||||||
public void testFuncPtr() {
|
public void testFuncPtr() {
|
||||||
loadcode(getAboveComment());
|
loadcode(getAboveComment());
|
||||||
String result = runQuickFixOneFile();
|
String result = runQuickFixOneFile();
|
||||||
assertContainedIn("void (*aFuncPtr)();", result);
|
assertContainedIn("void (*aFuncPtr)();", result); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue