diff options
author | Andrew Gvozdev | 2011-11-17 22:34:21 +0000 |
---|---|---|
committer | Andrew Gvozdev | 2011-11-17 22:34:21 +0000 |
commit | 2a1cddd71635c39ae336ba43bb89cecbfb09e21f (patch) | |
tree | c7a504d11610c16c23c34e29bba23ba0b280bb81 /build/org.eclipse.cdt.make.core.tests | |
parent | e47db971decd8fd15ce52984be3de50b6eaa24de (diff) | |
download | org.eclipse.cdt-2a1cddd71635c39ae336ba43bb89cecbfb09e21f.tar.gz org.eclipse.cdt-2a1cddd71635c39ae336ba43bb89cecbfb09e21f.tar.xz org.eclipse.cdt-2a1cddd71635c39ae336ba43bb89cecbfb09e21f.zip |
auto-clean: @Override annotations + organize imports + unnecessary
casts/$NON-NLS + trailing white spaces
Diffstat (limited to 'build/org.eclipse.cdt.make.core.tests')
6 files changed, 110 insertions, 98 deletions
diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java index 5fe246c8886..fe7753a8533 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java @@ -38,27 +38,27 @@ public class CDataProviderTests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(CDataProviderTests.class); - + // // Add the relevant tests to the suite // suite.addTest(new StandardBuildTests("testProjectCreation")); // suite.addTest(new StandardBuildTests("testProjectSettings")); // suite.addTest(new StandardBuildTests("testProjectConversion")); // suite.addTest(new StandardBuildTests("testProjectCleanup")); -// +// // suite.addTestSuite(ScannerConfigConsoleParserTests.class); // suite.addTestSuite(ScannerConfigDiscoveryTests.class); - + return suite; } - + public void testCData() throws Exception { IProject project = createProject("a1"); ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project); assertNotNull("project description should not be null", projDes); - + ICConfigurationDescription cfgs[] = projDes.getConfigurations(); assertEquals(1, cfgs.length); - + int lssNum = cfgs[0].getRootFolderDescription().getLanguageSettings().length; int rcDessNum = cfgs[0].getResourceDescriptions().length; assertTrue(rcDessNum > 0); @@ -67,9 +67,9 @@ public class CDataProviderTests extends TestCase { assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); - + CCorePlugin.getDefault().setProjectDescription(project, projDes); - + projDes = CCorePlugin.getDefault().getProjectDescription(project); assertEquals(2, projDes.getConfigurations().length); cfgs = projDes.getConfigurations(); @@ -89,16 +89,16 @@ public class CDataProviderTests extends TestCase { assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); - + project.delete(false, true, new NullProgressMonitor()); - + project = ResourcesPlugin.getWorkspace().getRoot().getProject("a1"); project.create(new NullProgressMonitor()); project.open(new NullProgressMonitor()); - + projDes = CCorePlugin.getDefault().getProjectDescription(project); assertNotNull("project description should not be null", projDes); - + cfgs = projDes.getConfigurations(); assertEquals(2, cfgs.length); cfg2 = cfgs[0]; @@ -106,18 +106,19 @@ public class CDataProviderTests extends TestCase { assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); - + cfg2 = cfgs[1]; assertNotNull(cfg2); assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); } - + private IProject createProject(final String name) throws CoreException { final Object[] result = new Object[1]; ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - + + @Override public void run(IProgressMonitor monitor) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(name); @@ -132,7 +133,7 @@ public class CDataProviderTests extends TestCase { if (!project.isOpen()) { project.open(null); } - + description = project.getDescription(); // ICommand[] commands = description.getBuildSpec(); // for (int i = 0; i < commands.length; ++i) { @@ -152,6 +153,6 @@ public class CDataProviderTests extends TestCase { result[0] = project; } }, null); - return (IProject)result[0]; + return (IProject)result[0]; } } diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java index c35167cf6f7..c5c20ec8d9e 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java @@ -50,43 +50,43 @@ public class StandardBuildTests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(StandardBuildTests.class.getName()); - + // Add the relevant tests to the suite suite.addTest(new StandardBuildTests("testProjectCreation")); suite.addTest(new StandardBuildTests("testProjectSettings")); suite.addTest(new StandardBuildTests("testProjectConversion")); suite.addTest(new StandardBuildTests("testProjectCleanup")); - + return suite; } - + private void checkDefaultProjectSettings(IProject project) throws Exception { assertNotNull(project); IMakeBuilderInfo defaultInfo = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, true); - + IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); // Check the rest of the project information assertEquals(defaultInfo.isDefaultBuildCmd(), builderInfo.isDefaultBuildCmd()); assertEquals(defaultInfo.isStopOnError(), builderInfo.isStopOnError()); assertEquals(defaultInfo.getBuildCommand(), builderInfo.getBuildCommand()); assertEquals(defaultInfo.getBuildArguments(), builderInfo.getBuildArguments()); - assertEquals(defaultInfo.getBuildLocation(), builderInfo.getBuildLocation()); + assertEquals(defaultInfo.getBuildLocation(), builderInfo.getBuildLocation()); - assertEquals(defaultInfo.isAutoBuildEnable(), builderInfo.isAutoBuildEnable()); - assertEquals(defaultInfo.getAutoBuildTarget(), builderInfo.getAutoBuildTarget()); - assertEquals(defaultInfo.isIncrementalBuildEnabled(), builderInfo.isIncrementalBuildEnabled()); - assertEquals(defaultInfo.getIncrementalBuildTarget(), builderInfo.getIncrementalBuildTarget()); - assertEquals(defaultInfo.isFullBuildEnabled(), builderInfo.isFullBuildEnabled()); + assertEquals(defaultInfo.isAutoBuildEnable(), builderInfo.isAutoBuildEnable()); + assertEquals(defaultInfo.getAutoBuildTarget(), builderInfo.getAutoBuildTarget()); + assertEquals(defaultInfo.isIncrementalBuildEnabled(), builderInfo.isIncrementalBuildEnabled()); + assertEquals(defaultInfo.getIncrementalBuildTarget(), builderInfo.getIncrementalBuildTarget()); + assertEquals(defaultInfo.isFullBuildEnabled(), builderInfo.isFullBuildEnabled()); assertEquals(defaultInfo.getFullBuildTarget(), builderInfo.getFullBuildTarget()); - assertEquals(defaultInfo.isCleanBuildEnabled(), builderInfo.isCleanBuildEnabled()); + assertEquals(defaultInfo.isCleanBuildEnabled(), builderInfo.isCleanBuildEnabled()); assertEquals(defaultInfo.getCleanBuildTarget(), builderInfo.getCleanBuildTarget()); - + } - + private void checkOverriddenProjectSettings(IProject project) throws Exception { assertNotNull(project); - + // Check the rest of the project information IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); assertEquals(OFF, builderInfo.isDefaultBuildCmd()); @@ -97,17 +97,18 @@ public class StandardBuildTests extends TestCase { } /** - * Create a new project named <code>name</code> or return the project in + * Create a new project named <code>name</code> or return the project in * the workspace of the same name if it exists. - * + * * @param name The name of the project to create or retrieve. - * @return + * @return * @throws CoreException */ private IProject createProject(final String name) throws CoreException { final Object[] result = new Object[1]; ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - + + @Override public void run(IProgressMonitor monitor) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(name); @@ -116,7 +117,7 @@ public class StandardBuildTests extends TestCase { } else { project.refreshLocal(IResource.DEPTH_INFINITE, null); } - + if (!project.isOpen()) { project.open(null); } @@ -124,13 +125,13 @@ public class StandardBuildTests extends TestCase { result[0] = project; } }, null); - return (IProject)result[0]; + return (IProject)result[0]; } /** - * Remove the <code>IProject</code> with the name specified in the argument from the + * Remove the <code>IProject</code> with the name specified in the argument from the * receiver's workspace. - * + * * @param name */ private void removeProject(String name) { @@ -161,10 +162,10 @@ public class StandardBuildTests extends TestCase { fail("StandardBuildTest testProjectConversion failed opening project: " + e.getLocalizedMessage()); } assertNotNull(project); - + // Check the settings (they should be the override values) checkOverriddenProjectSettings(project); - + // Now convert the project try { CCorePlugin.getDefault().convertProjectFromCtoCC(project, new NullProgressMonitor()); @@ -190,19 +191,19 @@ public class StandardBuildTests extends TestCase { } catch (CoreException e) { fail("StandardBuildTest testProjectConversion failed getting nature: " + e.getLocalizedMessage()); } - + // Nothing should have changed in the settings checkOverriddenProjectSettings(project); } /** - * + * */ public void testProjectCreation() throws Exception { // Create a new project IProject project = null; try { - project = createProject(PROJECT_NAME); + project = createProject(PROJECT_NAME); // Convert the new project to a standard make project MakeProjectNature.addNature(project, null); } catch (CoreException e) { @@ -225,7 +226,7 @@ public class StandardBuildTests extends TestCase { // Check the default settings checkDefaultProjectSettings(project); } - + public void testProjectSettings() throws Exception { // Get the project IProject project = null; @@ -235,7 +236,7 @@ public class StandardBuildTests extends TestCase { fail("StandardBuildTest testProjectSettings failed opening project: " + e.getLocalizedMessage()); } assertNotNull(project); - + // Use the build info for the rest of the settings IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); builderInfo.setStopOnError(ON); @@ -253,7 +254,7 @@ public class StandardBuildTests extends TestCase { } catch (CoreException e) { fail ("StandardBuildTest testProjectSettings failed to open project " + e.getLocalizedMessage()); } - + // Retest checkOverriddenProjectSettings(project); } diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java index 553d808c70b..888598ae09e 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java @@ -54,7 +54,7 @@ public class MakefileReaderProviderTests extends TestCase { basePath + "incl" }; } - + public void testNoReaderProvider() throws Exception { IPath path = new Path("data/Makefile.main"); File file = getPluginRelativeFile(path); @@ -80,13 +80,14 @@ public class MakefileReaderProviderTests extends TestCase { public void testInputStreamReaderProvider() throws Exception { IPath path = new Path("Makefile.main"); - + // get base directory for searches final URL url = getPluginRelativeURL(new Path("data").addTrailingSeparator()); IMakefile makefile = MakeCorePlugin.createMakefile( URIUtil.toURI(path), true, inclDirs, new IMakefileReaderProvider() { + @Override public Reader getReader(URI fileURI) throws IOException { URL fileUrl; try { @@ -97,9 +98,9 @@ public class MakefileReaderProviderTests extends TestCase { InputStream is = fileUrl.openStream(); return new InputStreamReader(is); } - + }); - + assertMakefileContents(makefile); } @@ -108,36 +109,38 @@ public class MakefileReaderProviderTests extends TestCase { URIUtil.toURI("/memory/Makefile.main"), true, inclDirs, new IMakefileReaderProvider() { + @Override public Reader getReader(URI fileURI) throws IOException { - String name = new File(fileURI).getName(); + String name = new File(fileURI).getName(); if (name.equals("Makefile.main")) return new StringReader( - "VAR = foo\r\n" + - "\r\n" + - "include Makefile.incl\r\n" + - "\r\n" + - "main: $(VAR)\r\n" + + "VAR = foo\r\n" + + "\r\n" + + "include Makefile.incl\r\n" + + "\r\n" + + "main: $(VAR)\r\n" + " nothing\r\n"); if (name.equals("Makefile.incl")) return new StringReader( - "INCLVAR = bar\r\n" + - "\r\n" + - "foo.o: .PHONY\r\n" + "INCLVAR = bar\r\n" + + "\r\n" + + "foo.o: .PHONY\r\n" ); - + throw new FileNotFoundException(fileURI.getPath()); } - + }); - + assertMakefileContents(makefile); } - + public void testReaderIsClosed_Bug338936() throws Exception { final boolean[] streamIsClosed = { false }; MakeCorePlugin.createMakefile( URIUtil.toURI("Makefile.main"), true, inclDirs, new IMakefileReaderProvider() { + @Override public Reader getReader(URI fileURI) throws IOException { return new StringReader("") { @Override @@ -147,7 +150,7 @@ public class MakefileReaderProviderTests extends TestCase { } }; } - + }); assertTrue("Stream is not closed", streamIsClosed[0]); } @@ -162,14 +165,14 @@ public class MakefileReaderProviderTests extends TestCase { assertEquals(2, macroDefinitions.length); assertEquals("VAR", macroDefinitions[0].getName()); assertEquals("INCLVAR", macroDefinitions[1].getName()); - + IRule[] rules = makefile.getRules(); assertEquals(2, rules.length); assertEquals("main", rules[0].getTarget().toString()); assertEquals("foo.o", rules[1].getTarget().toString()); } - /** + /** * Try to get a file in the development version of a plugin -- * will return <code>null</code> for a jar-packaged plugin. * @param path @@ -183,11 +186,11 @@ public class MakefileReaderProviderTests extends TestCase { return new File(url.getPath()); return null; } - + private URL getPluginRelativeURL(IPath path) throws Exception { if (MakeTestsPlugin.getDefault() != null) { URL url = FileLocator.find( - MakeTestsPlugin.getDefault().getBundle(), + MakeTestsPlugin.getDefault().getBundle(), path, null); return url != null ? FileLocator.toFileURL(url) : null; } diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java index d3bc57b6b61..072d7e838f9 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java @@ -33,22 +33,22 @@ import org.eclipse.core.runtime.Path; public class StandardBuildTestHelper { /* (non-Javadoc) - * Create a new project named <code>name</code> or return the project in + * Create a new project named <code>name</code> or return the project in * the workspace of the same name if it exists. - * + * * @param name The name of the project to create or retrieve. - * @return + * @return * @throws CoreException */ static public IProject createProject( - final String name, - final IPath location, - final String projectId) + final String name, + final IPath location, + final String projectId) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription workspaceDesc = workspace.getDescription(); @@ -60,19 +60,19 @@ public class StandardBuildTestHelper { } else { project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); } - - return project; + + return project; } - + /** - * Remove the <code>IProject</code> with the name specified in the argument from the + * Remove the <code>IProject</code> with the name specified in the argument from the * receiver's workspace. - * + * * @param name */ static public void removeProject(String name) { @@ -81,6 +81,7 @@ public class StandardBuildTestHelper { if (project.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { System.gc(); System.runFinalization(); @@ -99,6 +100,7 @@ public class StandardBuildTestHelper { static public boolean compareBenchmarks(final IProject project, IPath testDir, IPath[] files) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -116,7 +118,7 @@ public class StandardBuildTestHelper { StringBuffer benchmarkBuffer = readContentsStripLineEnds(project, benchmarkFile); if (!testBuffer.toString().equals(benchmarkBuffer.toString())) { Assert.fail("File " + testFile.lastSegment() + " does not match its benchmark."); - } + } } return true; } @@ -124,6 +126,7 @@ public class StandardBuildTestHelper { static public boolean verifyFilesDoNotExist(final IProject project, IPath testDir, IPath[] files) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -141,7 +144,7 @@ public class StandardBuildTestHelper { if (fullPath.toFile().exists()) { Assert.fail("File " + testFile.lastSegment() + " unexpectedly found."); return false; - } + } } catch (Exception e) { Assert.fail("File " + fullPath.toString() + " could not be referenced."); } @@ -174,7 +177,7 @@ public class StandardBuildTestHelper { } return buff; } - + static public IPath copyFilesToTempDir(IPath srcDir, IPath tmpSubDir, IPath[] files) { IPath tmpSrcDir = null; String userDirStr = System.getProperty("user.home"); @@ -182,7 +185,7 @@ public class StandardBuildTestHelper { IPath userDir = Path.fromOSString(userDirStr); tmpSrcDir = userDir.append(tmpSubDir); if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) { - Assert.fail("Temporary sub-directory cannot be the empty string."); + Assert.fail("Temporary sub-directory cannot be the empty string."); } else { File tmpSrcDirFile = tmpSrcDir.toFile(); if (tmpSrcDirFile.exists()) { @@ -238,7 +241,7 @@ public class StandardBuildTestHelper { } return tmpSrcDir; } - + static public void deleteTempDir(IPath tmpSubDir, IPath[] files) { IPath tmpSrcDir = null; String userDirStr = System.getProperty("user.home"); @@ -246,11 +249,11 @@ public class StandardBuildTestHelper { IPath userDir = Path.fromOSString(userDirStr); tmpSrcDir = userDir.append(tmpSubDir); if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) { - Assert.fail("Temporary sub-directory cannot be the empty string."); + Assert.fail("Temporary sub-directory cannot be the empty string."); } else { File tmpSrcDirFile = tmpSrcDir.toFile(); if (!tmpSrcDirFile.exists()) { - Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " does not exist."); + Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " does not exist."); } else { for (int i=0; i<files.length; i++) { // Delete the file diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/GCCPerFileBOPConsoleParserTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/GCCPerFileBOPConsoleParserTests.java index 6c396faa4d7..0b2882d76c7 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/GCCPerFileBOPConsoleParserTests.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/GCCPerFileBOPConsoleParserTests.java @@ -8,7 +8,7 @@ * Contributors: * Markus Schorn - initial API and implementation * Anton Leherbauer (Wind River Systems) - *******************************************************************************/ + *******************************************************************************/ package org.eclipse.cdt.make.scannerdiscovery; import java.io.File; @@ -31,8 +31,10 @@ import org.eclipse.core.runtime.Path; public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests { private final static IMarkerGenerator MARKER_GENERATOR= new IMarkerGenerator() { + @Override public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) { } + @Override public void addMarker(ProblemMarkerInfo problemMarkerInfo) { } }; @@ -66,7 +68,7 @@ public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests { CProjectHelper.delete(fCProject); } } - + public void testParsingIfStatement_bug197930() throws Exception { fOutputParser.processLine("if gcc -g -O0 -I\"include abc\" -c impl/testmath.c; then ; fi"); //$NON-NLS-1$ @@ -75,7 +77,7 @@ public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests { CCommandDSC command= (CCommandDSC) cmds.get(0); assertEquals("gcc", command.getCompilerName()); } - + public void testResolvingLinkedFolder_Bug213690() throws Exception { File tempRoot= new File(System.getProperty("java.io.tmpdir")); File tempDir= new File(tempRoot, "cdttest_213690").getCanonicalFile(); @@ -116,19 +118,19 @@ public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests { tempDir.delete(); } } - + public void testPwdInFilePath_Bug237958() throws Exception { IFile file1= fCProject.getProject().getFile("Bug237958_1.c"); IFile file2= fCProject.getProject().getFile("Bug237958_2.c"); - fOutputParser.processLine("gcc -g -DTEST1 -c `pwd`/Bug237958_1.c"); - fOutputParser.processLine("gcc -DTEST2=12 -g -ggdb -Wall -c \"`pwd`/./Bug237958_2.c\""); + fOutputParser.processLine("gcc -g -DTEST1 -c `pwd`/Bug237958_1.c"); + fOutputParser.processLine("gcc -DTEST2=12 -g -ggdb -Wall -c \"`pwd`/./Bug237958_2.c\""); List<?> cmds = fCollector.getCollectedScannerInfo(file1, ScannerInfoTypes.COMPILER_COMMAND); CCommandDSC cdsc= (CCommandDSC) cmds.get(0); List<?> symbols= cdsc.getSymbols(); assertEquals(1, symbols.size()); assertEquals("TEST1=1", symbols.get(0).toString()); - + cmds = fCollector.getCollectedScannerInfo(file2, ScannerInfoTypes.COMPILER_COMMAND); cdsc= (CCommandDSC) cmds.get(0); symbols= cdsc.getSymbols(); diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java index 7b4e4199087..9c0ac11d37b 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java @@ -8,7 +8,7 @@ * Contributors: * Markus Schorn - initial API and implementation * Anton Leherbauer (Wind River Systems) - *******************************************************************************/ + *******************************************************************************/ package org.eclipse.cdt.make.scannerdiscovery; import java.util.ArrayList; @@ -27,7 +27,8 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC; final class TestScannerInfoCollector implements IScannerInfoCollector { private HashMap<ScannerInfoTypes, List> fInfoMap = new HashMap<ScannerInfoTypes, List>(); private HashMap<Object, Map<ScannerInfoTypes, List>> fResourceToInfoMap = new HashMap<Object, Map<ScannerInfoTypes, List>>(); - + + @Override public void contributeToScannerConfig(Object resource, Map scannerInfo0) { Map<ScannerInfoTypes, List> scannerInfo = scannerInfo0; Set<Entry<ScannerInfoTypes, List>> entrySet = scannerInfo.entrySet(); @@ -59,6 +60,7 @@ final class TestScannerInfoCollector implements IScannerInfoCollector { target.addAll(col); } + @Override public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { if (resource == null) { List result= fInfoMap.get(type); |