mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
Fix compile error
This commit is contained in:
parent
c039cc7cfc
commit
6892a28e3d
1 changed files with 12 additions and 13 deletions
|
@ -17,17 +17,21 @@ import org.eclipse.cdt.codan.core.CodanRuntime;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblemReporter;
|
import org.eclipse.cdt.codan.core.model.IProblemReporter;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alena
|
* @author Alena
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CheckerTestCase extends CodanTestCase {
|
public class CheckerTestCase extends CodanTestCase {
|
||||||
|
private static final IProgressMonitor NullPM = new NullProgressMonitor();
|
||||||
private IMarker[] markers;
|
private IMarker[] markers;
|
||||||
|
|
||||||
public void checkErrorLine(int i) {
|
public void checkErrorLine(int i) {
|
||||||
checkErrorLine(currentFile, i);
|
checkErrorLine(currentFile, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param i
|
* @param i
|
||||||
* - line
|
* - line
|
||||||
|
@ -51,21 +55,18 @@ public class CheckerTestCase extends CodanTestCase {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
}
|
}
|
||||||
String mfile = m.getResource().getName();
|
String mfile = m.getResource().getName();
|
||||||
if (line.equals(i)) {
|
if (line.equals(i)) {
|
||||||
found = true;
|
found = true;
|
||||||
if (file!=null && !file.getName().equals(mfile))
|
if (file != null && !file.getName().equals(mfile)) found = false;
|
||||||
found = false;
|
else break;
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue("Error on line " + i + " not found ", found);
|
assertTrue("Error on line " + i + " not found ", found);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkNoErrors() {
|
public void checkNoErrors() {
|
||||||
assertTrue("Found errors but should not", markers == null
|
assertTrue("Found errors but should not", markers == null || markers.length == 0);
|
||||||
|| markers.length == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,21 +85,19 @@ public class CheckerTestCase extends CodanTestCase {
|
||||||
loadcode(code);
|
loadcode(code);
|
||||||
runCodan();
|
runCodan();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadCodeAndRunCpp(String code) {
|
public void loadCodeAndRunCpp(String code) {
|
||||||
loadcode(code, true);
|
loadcode(code, true);
|
||||||
runCodan();
|
runCodan();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void runCodan() {
|
protected void runCodan() {
|
||||||
CodanRuntime.getInstance().getBuilder().processResource(
|
CodanRuntime.getInstance().getBuilder().processResource(cproject.getProject(), NullPM);
|
||||||
cproject.getProject(), NPM);
|
|
||||||
try {
|
try {
|
||||||
markers = cproject.getProject()
|
markers = cproject.getProject().findMarkers(IProblemReporter.GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, 1);
|
||||||
.findMarkers(
|
|
||||||
IProblemReporter.GENERIC_CODE_ANALYSIS_MARKER_TYPE,
|
|
||||||
true, 1);
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue