1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +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:
Alexander Kurtakov 2015-12-04 14:16:06 +02:00
parent 6f36a51b5b
commit 06208afa79
2 changed files with 19 additions and 19 deletions

View file

@ -24,6 +24,7 @@ import org.junit.runners.Suite;
AutotoolsProjectTest2.class,
AutotoolsVirtualFolderTest.class,
AutotoolsEnvironmentVarTest.class,
LibtoolGCCBuildCommandParserTest.class,
UpdateConfigureTest.class,
AutoconfTests.class,
EditorTests.class

View file

@ -11,6 +11,9 @@
package org.eclipse.cdt.autotools.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
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.ICProjectDescriptionManager;
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.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.junit.Test;
/**
* 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
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
public void testProcessLine() throws Exception {
// Create model project and accompanied descriptions
String projectName = getName();
String projectName = "testProcessLine";
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
IFile file1=ResourceHelper.createFile(project, "file1.cpp");
IFile file2=ResourceHelper.createFile(project, "file2.cpp");
IFile file3=ResourceHelper.createFile(project, "file3.cpp");
IFile file1 = ResourceHelper.createFile(project, "file1.cpp");
IFile file2 = ResourceHelper.createFile(project, "file2.cpp");
IFile file3 = ResourceHelper.createFile(project, "file3.cpp");
@SuppressWarnings("deprecation")
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(file1.getProjectRelativePath(), true);
String languageId = ls.getLanguageId();
// create GCCBuildCommandParser
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(BUILD_COMMAND_PARSER_EXT, true);
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager
.getExtensionProviderCopy(BUILD_COMMAND_PARSER_EXT, true);
// parse line
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: cc -I/path0 file3.cpp");
parser.shutdown();
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
}
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
}
{
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId);
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
}
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
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);
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
}
}