mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +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;
|
||||
|
||||
public class ProblemBindingCheckerTest extends CheckerTestCase {
|
||||
// @Override
|
||||
@Override
|
||||
public boolean isCpp() {
|
||||
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.SuggestedParenthesisCheckerTest;
|
||||
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;
|
||||
|
||||
public class AutomatedIntegrationSuite extends TestSuite {
|
||||
|
@ -62,6 +63,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
|||
suite.addTest(CodanFastTestSuite.suite());
|
||||
// quick fixes
|
||||
suite.addTestSuite(SuggestedParenthesisQuickFixTest.class);
|
||||
suite.addTestSuite(CreateLocalVariableQuickFixTest.class);
|
||||
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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,6 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
|
||||
|
||||
import org.eclipse.cdt.codan.internal.checkers.ProblemBindingChecker;
|
||||
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
|
||||
|
||||
/**
|
||||
|
@ -22,14 +23,30 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
|||
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() {
|
||||
// aChar = 'a';
|
||||
// }
|
||||
@SuppressWarnings("restriction")
|
||||
public void testChar() {
|
||||
loadcode(getAboveComment());
|
||||
String result = runQuickFixOneFile();
|
||||
assertContainedIn("char aChar;", result);
|
||||
assertContainedIn("char aChar;", result); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// void func() {
|
||||
|
@ -38,7 +55,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
|||
public void testDouble() {
|
||||
loadcode(getAboveComment());
|
||||
String result = runQuickFixOneFile();
|
||||
assertContainedIn("double aDouble;", result);
|
||||
assertContainedIn("double aDouble;", result); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// void func() {
|
||||
|
@ -47,7 +64,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
|||
public void testString() {
|
||||
loadcode(getAboveComment());
|
||||
String result = runQuickFixOneFile();
|
||||
assertContainedIn("const char *aString;", result);
|
||||
assertContainedIn("const char *aString;", result); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// void func() {
|
||||
|
@ -56,7 +73,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
|||
public void testWString() {
|
||||
loadcode(getAboveComment());
|
||||
String result = runQuickFixOneFile();
|
||||
assertContainedIn("const wchar_t *aWString;", result);
|
||||
assertContainedIn("const wchar_t *aWString;", result); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// void func() {
|
||||
|
@ -65,6 +82,6 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
|||
public void testFuncPtr() {
|
||||
loadcode(getAboveComment());
|
||||
String result = runQuickFixOneFile();
|
||||
assertContainedIn("void (*aFuncPtr)();", result);
|
||||
assertContainedIn("void (*aFuncPtr)();", result); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue