1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

test to run SpecsDetectors globally without a project

This commit is contained in:
Andrew Gvozdev 2011-09-14 11:18:11 -04:00
parent e101cace9e
commit c82202c144

View file

@ -335,6 +335,28 @@ public class GCCBuiltinSpecsDetectorTest extends TestCase {
assertEquals(expected, entries.get(0));
}
public void testAbstractBuiltinSpecsDetector_RunGlobal() throws Exception {
AbstractBuiltinSpecsDetector detector = new GCCBuiltinSpecsDetector() {
@Override
protected boolean runProgram(String command, String[] env, IPath workingDirectory, IProgressMonitor monitor,
OutputStream consoleOut, OutputStream consoleErr) throws CoreException, IOException {
printLine(consoleOut, "#define MACRO VALUE");
consoleOut.close();
consoleErr.close();
return true;
}
};
detector.setLanguageScope(new ArrayList<String>() {{add(LANGUAGE_ID);}});
detector.run((IProject)null, LANGUAGE_ID, null, null, null);
assertFalse(detector.isEmpty());
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, LANGUAGE_ID);
ICLanguageSettingEntry expected = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
assertEquals(expected, entries.get(0));
}
public void testAbstractBuiltinSpecsDetector_RunOnce() throws Exception {
// Create model project and accompanied descriptions
String projectName = getName();