mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
autotools: Convert the last JUnit 3.x style test.
And hook it in the test suite. Change-Id: I4a9b533ff3122e667dbad65655189afcca8dc28e Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
6f36a51b5b
commit
06208afa79
2 changed files with 19 additions and 19 deletions
|
@ -24,6 +24,7 @@ import org.junit.runners.Suite;
|
||||||
AutotoolsProjectTest2.class,
|
AutotoolsProjectTest2.class,
|
||||||
AutotoolsVirtualFolderTest.class,
|
AutotoolsVirtualFolderTest.class,
|
||||||
AutotoolsEnvironmentVarTest.class,
|
AutotoolsEnvironmentVarTest.class,
|
||||||
|
LibtoolGCCBuildCommandParserTest.class,
|
||||||
UpdateConfigureTest.class,
|
UpdateConfigureTest.class,
|
||||||
AutoconfTests.class,
|
AutoconfTests.class,
|
||||||
EditorTests.class
|
EditorTests.class
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.autotools.tests;
|
package org.eclipse.cdt.autotools.tests;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
@ -22,15 +25,15 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
|
||||||
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases to test libtool build command parser.
|
* Test cases to test libtool build command parser.
|
||||||
*/
|
*/
|
||||||
public class LibtoolGCCBuildCommandParserTest extends BaseTestCase {
|
public class LibtoolGCCBuildCommandParserTest {
|
||||||
// ID of the parser taken from the extension point
|
// ID of the parser taken from the extension point
|
||||||
private static final String BUILD_COMMAND_PARSER_EXT = "org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser"; //$NON-NLS-1$
|
private static final String BUILD_COMMAND_PARSER_EXT = "org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -52,22 +55,24 @@ public class LibtoolGCCBuildCommandParserTest extends BaseTestCase {
|
||||||
/**
|
/**
|
||||||
* Test possible variations of libtool/compiler command.
|
* Test possible variations of libtool/compiler command.
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testProcessLine() throws Exception {
|
public void testProcessLine() throws Exception {
|
||||||
// Create model project and accompanied descriptions
|
// Create model project and accompanied descriptions
|
||||||
String projectName = getName();
|
String projectName = "testProcessLine";
|
||||||
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
||||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
|
|
||||||
IFile file1=ResourceHelper.createFile(project, "file1.cpp");
|
IFile file1 = ResourceHelper.createFile(project, "file1.cpp");
|
||||||
IFile file2=ResourceHelper.createFile(project, "file2.cpp");
|
IFile file2 = ResourceHelper.createFile(project, "file2.cpp");
|
||||||
IFile file3=ResourceHelper.createFile(project, "file3.cpp");
|
IFile file3 = ResourceHelper.createFile(project, "file3.cpp");
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(file1.getProjectRelativePath(), true);
|
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(file1.getProjectRelativePath(), true);
|
||||||
String languageId = ls.getLanguageId();
|
String languageId = ls.getLanguageId();
|
||||||
|
|
||||||
// create GCCBuildCommandParser
|
// create GCCBuildCommandParser
|
||||||
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(BUILD_COMMAND_PARSER_EXT, true);
|
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager
|
||||||
|
.getExtensionProviderCopy(BUILD_COMMAND_PARSER_EXT, true);
|
||||||
|
|
||||||
// parse line
|
// parse line
|
||||||
parser.startup(cfgDescription, null);
|
parser.startup(cfgDescription, null);
|
||||||
|
@ -75,18 +80,12 @@ public class LibtoolGCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.processLine("libtool: compile: g++ -I/path0 file2.cpp");
|
parser.processLine("libtool: compile: g++ -I/path0 file2.cpp");
|
||||||
parser.processLine("libtool: compile: cc -I/path0 file3.cpp");
|
parser.processLine("libtool: compile: cc -I/path0 file3.cpp");
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
{
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
||||||
}
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
{
|
entries = parser.getSettingEntries(cfgDescription, file3, languageId);
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId);
|
|
||||||
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue