mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
[264715] - fixed tests (applied patch)
This commit is contained in:
parent
586be423c5
commit
5d8b09046e
2 changed files with 26 additions and 12 deletions
|
@ -43,8 +43,8 @@ public class ErrorParserFileMatchingTest extends TestCase {
|
|||
private final static String testName = "FindMatchingFilesTest";
|
||||
|
||||
// Default project gets created once then used by all test cases.
|
||||
private final IProject fProject;
|
||||
private final String mockErrorParserId;
|
||||
private IProject fProject = null;
|
||||
private String mockErrorParserId = null;
|
||||
private ArrayList<ProblemMarkerInfo> errorList;
|
||||
|
||||
private final IMarkerGenerator markerGenerator = new IMarkerGenerator() {
|
||||
|
@ -77,20 +77,16 @@ public class ErrorParserFileMatchingTest extends TestCase {
|
|||
*/
|
||||
public ErrorParserFileMatchingTest(String name) {
|
||||
super(name);
|
||||
IProject project = null;
|
||||
try {
|
||||
project = ResourceHelper.createCDTProject(testName);
|
||||
} catch (Exception e) {
|
||||
Assert.fail(e.toString());
|
||||
}
|
||||
fProject = project;
|
||||
Assert.assertNotNull(project);
|
||||
|
||||
mockErrorParserId = addErrorParserExtension("MockErrorParser", MockErrorParser.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
if (fProject==null) {
|
||||
fProject = ResourceHelper.createCDTProject(testName);
|
||||
Assert.assertNotNull(fProject);
|
||||
mockErrorParserId = addErrorParserExtension("MockErrorParser", MockErrorParser.class);
|
||||
}
|
||||
errorList = new ArrayList<ProblemMarkerInfo>();
|
||||
}
|
||||
|
||||
|
@ -114,6 +110,15 @@ public class ErrorParserFileMatchingTest extends TestCase {
|
|||
junit.textui.TestRunner.run(suite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Error Parser extension to the global repository.
|
||||
* Note that this function will "pollute" the working environment and
|
||||
* the error parser will be seen by other test cases as well.
|
||||
*
|
||||
* @param shortId - last portion of ID with which error parser will be added.
|
||||
* @param cl - Error Parser class
|
||||
* @return - full ID of the error parser (generated by the method).
|
||||
*/
|
||||
private static String addErrorParserExtension(String shortId, Class cl) {
|
||||
String ext = "<plugin><extension id=\"" + shortId + "\" name=\"" + shortId
|
||||
+ "\" point=\"org.eclipse.cdt.core.ErrorParser\">" + "<errorparser class=\"" + cl.getName() + "\"/>"
|
||||
|
|
|
@ -74,6 +74,7 @@ public class ErrorParserManagerTest extends TestCase {
|
|||
* Example code test the packages in the project
|
||||
* "com.qnx.tools.ide.cdt.core"
|
||||
*/
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
/***
|
||||
* The test of the tests assume that they have a working workspace
|
||||
|
@ -106,7 +107,14 @@ public class ErrorParserManagerTest extends TestCase {
|
|||
}
|
||||
|
||||
};
|
||||
epManager = new ErrorParserManager(cProject.getProject(), markerGenerator, null);
|
||||
String[] errorParsersIds = {
|
||||
"org.eclipse.cdt.core.MakeErrorParser",
|
||||
"org.eclipse.cdt.core.GCCErrorParser",
|
||||
"org.eclipse.cdt.core.GASErrorParser",
|
||||
"org.eclipse.cdt.core.GLDErrorParser",
|
||||
"org.eclipse.cdt.core.VCErrorParser",
|
||||
};
|
||||
epManager = new ErrorParserManager(cProject.getProject(), markerGenerator, errorParsersIds);
|
||||
|
||||
}
|
||||
|
||||
|
@ -115,6 +123,7 @@ public class ErrorParserManagerTest extends TestCase {
|
|||
*
|
||||
* Called after every test case method.
|
||||
*/
|
||||
@Override
|
||||
protected void tearDown() {
|
||||
// release resources here and clean-up
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue