From 06208afa797cfda310f8667e1f273685a06b7fd4 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Fri, 4 Dec 2015 14:16:06 +0200 Subject: [PATCH] autotools: Convert the last JUnit 3.x style test. And hook it in the test suite. Change-Id: I4a9b533ff3122e667dbad65655189afcca8dc28e Signed-off-by: Alexander Kurtakov --- .../autotools/tests/AllAutotoolsTests.java | 1 + .../LibtoolGCCBuildCommandParserTest.java | 37 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/AllAutotoolsTests.java b/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/AllAutotoolsTests.java index 76345d7d23a..594217df747 100644 --- a/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/AllAutotoolsTests.java +++ b/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/AllAutotoolsTests.java @@ -24,6 +24,7 @@ import org.junit.runners.Suite; AutotoolsProjectTest2.class, AutotoolsVirtualFolderTest.class, AutotoolsEnvironmentVarTest.class, + LibtoolGCCBuildCommandParserTest.class, UpdateConfigureTest.class, AutoconfTests.class, EditorTests.class diff --git a/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java b/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java index 686b8ea11ac..708b89b79ea 100644 --- a/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java +++ b/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java @@ -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 entries = parser.getSettingEntries(cfgDescription, file1, languageId); - assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0)); - } - { - List entries = parser.getSettingEntries(cfgDescription, file2, languageId); - assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0)); - } - { - List entries = parser.getSettingEntries(cfgDescription, file3, languageId); - assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0)); - } + List 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)); } } \ No newline at end of file