1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-04-28 17:37:09 -07:00
parent 82fb03e1a0
commit db6b4cf5ac
2 changed files with 42 additions and 55 deletions

View file

@ -16,14 +16,9 @@ import org.eclipse.cdt.codan.core.test.CheckerTestCase;
import org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker;
/**
* Test for {@link#CaseBreakChecker} class
* Test for {@link CaseBreakChecker} class
*/
public class CaseBreakCheckerTest extends CheckerTestCase {
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.test.CodanTestCase#setUp()
*/
@Override
public void setUp() throws Exception {
super.setUp();

View file

@ -120,18 +120,13 @@ public class CheckerTestCase extends CodanTestCase {
}
public void checkNoErrors() {
if (markers == null || markers.length == 0) {
// all good
} else {
if (markers != null && markers.length > 0) {
IMarker m = markers[0];
fail("Found " + markers.length + " errors but should not. First " + CodanProblemMarker.getProblemId(m) + " at line "
+ getLine(m));
fail("Found " + markers.length + " errors but should not. First " +
CodanProblemMarker.getProblemId(m) + " at line " + getLine(m));
}
}
/**
*
*/
public void runOnProject() {
try {
indexFiles();
@ -151,9 +146,6 @@ public class CheckerTestCase extends CodanTestCase {
runCodan();
}
/**
*
*/
protected void runCodan() {
CodanRuntime.getInstance().getBuilder().processResource(cproject.getProject(), new NullProgressMonitor());
try {
@ -169,8 +161,9 @@ public class CheckerTestCase extends CodanTestCase {
* @return
*/
protected IProblemPreference getPreference(String problemId, String paramId) {
IProblem problem = CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(cproject.getResource())
.findProblem(problemId);
IProblemProfile resourceProfile =
CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(cproject.getResource());
IProblem problem = resourceProfile.findProblem(problemId);
IProblemPreference pref = ((MapProblemPreference) problem.getPreference()).getChildDescriptor(paramId);
return pref;
}
@ -219,8 +212,8 @@ public class CheckerTestCase extends CodanTestCase {
String pid = ids[j];
if (p.getId().equals(pid)) {
enabled = true;
// Force the launch mode to FULL_BUILD to make sure we can test the problem even if by default it
// is not set to run on FULL_BUILD
// Force the launch mode to FULL_BUILD to make sure we can test the problem even
// if by default it is not set to run on FULL_BUILD.
IProblemPreference preference = p.getPreference();
if (preference instanceof RootProblemPreference) {
RootProblemPreference rootProblemPreference = (RootProblemPreference) preference;
@ -232,6 +225,5 @@ public class CheckerTestCase extends CodanTestCase {
((CodanProblem) p).setEnabled(enabled);
}
CodanRuntime.getInstance().getCheckersRegistry().updateProfile(cproject.getProject(), profile);
return;
}
}