mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
autotools: Modernize o.e.cdt.autotools.tests bundle.
* Use generics. * Add missing Override annotations * Migrate to JUnit 4 * Drop non-javadoc comments. Change-Id: Ic715a7375fb052bdbc4385f0528d40197060eda3 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
4d5e9569e6
commit
20ff8a3cbc
22 changed files with 528 additions and 357 deletions
|
@ -1,11 +1,101 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
|
||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
|
|
@ -1,3 +1,61 @@
|
|||
#Mon Dec 11 11:40:26 EST 2006
|
||||
eclipse.preferences.version=1
|
||||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
||||
internal.default.compliance=default
|
||||
sp_cleanup.add_default_serial_version_id=true
|
||||
sp_cleanup.add_generated_serial_version_id=false
|
||||
sp_cleanup.add_missing_annotations=true
|
||||
sp_cleanup.add_missing_deprecated_annotations=true
|
||||
sp_cleanup.add_missing_methods=false
|
||||
sp_cleanup.add_missing_nls_tags=false
|
||||
sp_cleanup.add_missing_override_annotations=true
|
||||
sp_cleanup.add_missing_override_annotations_interface_methods=true
|
||||
sp_cleanup.add_serial_version_id=false
|
||||
sp_cleanup.always_use_blocks=true
|
||||
sp_cleanup.always_use_parentheses_in_expressions=false
|
||||
sp_cleanup.always_use_this_for_non_static_field_access=false
|
||||
sp_cleanup.always_use_this_for_non_static_method_access=false
|
||||
sp_cleanup.convert_functional_interfaces=false
|
||||
sp_cleanup.convert_to_enhanced_for_loop=false
|
||||
sp_cleanup.correct_indentation=false
|
||||
sp_cleanup.format_source_code=false
|
||||
sp_cleanup.format_source_code_changes_only=false
|
||||
sp_cleanup.insert_inferred_type_arguments=false
|
||||
sp_cleanup.make_local_variable_final=true
|
||||
sp_cleanup.make_parameters_final=false
|
||||
sp_cleanup.make_private_fields_final=true
|
||||
sp_cleanup.make_type_abstract_if_missing_method=false
|
||||
sp_cleanup.make_variable_declarations_final=false
|
||||
sp_cleanup.never_use_blocks=false
|
||||
sp_cleanup.never_use_parentheses_in_expressions=true
|
||||
sp_cleanup.on_save_use_additional_actions=false
|
||||
sp_cleanup.organize_imports=true
|
||||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
sp_cleanup.remove_private_constructors=true
|
||||
sp_cleanup.remove_redundant_type_arguments=true
|
||||
sp_cleanup.remove_trailing_whitespaces=false
|
||||
sp_cleanup.remove_trailing_whitespaces_all=true
|
||||
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
|
||||
sp_cleanup.remove_unnecessary_casts=true
|
||||
sp_cleanup.remove_unnecessary_nls_tags=false
|
||||
sp_cleanup.remove_unused_imports=false
|
||||
sp_cleanup.remove_unused_local_variables=false
|
||||
sp_cleanup.remove_unused_private_fields=true
|
||||
sp_cleanup.remove_unused_private_members=false
|
||||
sp_cleanup.remove_unused_private_methods=true
|
||||
sp_cleanup.remove_unused_private_types=true
|
||||
sp_cleanup.sort_members=false
|
||||
sp_cleanup.sort_members_all=false
|
||||
sp_cleanup.use_anonymous_class_creation=false
|
||||
sp_cleanup.use_blocks=false
|
||||
sp_cleanup.use_blocks_only_for_return_and_throw=false
|
||||
sp_cleanup.use_lambda=true
|
||||
sp_cleanup.use_parentheses_in_expressions=false
|
||||
sp_cleanup.use_this_for_non_static_field_access=false
|
||||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
||||
sp_cleanup.use_this_for_non_static_method_access=false
|
||||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
sp_cleanup.use_type_arguments=false
|
||||
|
|
|
@ -12,28 +12,21 @@ package org.eclipse.cdt.autotools.tests;
|
|||
|
||||
import org.eclipse.cdt.autotools.tests.autoconf.AutoconfTests;
|
||||
import org.eclipse.cdt.autotools.tests.editors.EditorTests;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
/** On Windows requires either Cygwin or MinGW to be in PATH */
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
AutotoolsProjectTest0.class,
|
||||
AutotoolsProjectNatureTest.class,
|
||||
AutotoolsProjectTest1.class,
|
||||
AutotoolsProjectTest2.class,
|
||||
AutotoolsVirtualFolderTest.class,
|
||||
AutotoolsEnvironmentVarTest.class,
|
||||
UpdateConfigureTest.class,
|
||||
AutoconfTests.class,
|
||||
EditorTests.class
|
||||
})
|
||||
public class AllAutotoolsTests {
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(
|
||||
"Test for org.eclipse.cdt.autotools.core.tests");
|
||||
//$JUnit-BEGIN$
|
||||
suite.addTestSuite(AutotoolsProjectTest0.class);
|
||||
suite.addTestSuite(AutotoolsProjectNatureTest.class);
|
||||
suite.addTestSuite(AutotoolsProjectTest1.class);
|
||||
suite.addTestSuite(AutotoolsProjectTest2.class);
|
||||
suite.addTestSuite(AutotoolsVirtualFolderTest.class);
|
||||
suite.addTestSuite(AutotoolsEnvironmentVarTest.class);
|
||||
suite.addTestSuite(UpdateConfigureTest.class);
|
||||
suite.addTest(AutoconfTests.suite());
|
||||
suite.addTest(EditorTests.suite());
|
||||
//$JUnit-END$
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -22,15 +27,16 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class AutotoolsEnvironmentVarTest extends TestCase {
|
||||
public class AutotoolsEnvironmentVarTest {
|
||||
|
||||
private IProject testProject;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
testProject = ProjectTools.createProject("testProject0");
|
||||
|
@ -47,6 +53,7 @@ public class AutotoolsEnvironmentVarTest extends TestCase {
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testAutotoolsEnvironmentVar() throws Exception {
|
||||
|
||||
Path p = new Path("zip/project1.zip");
|
||||
|
@ -66,7 +73,8 @@ public class AutotoolsEnvironmentVarTest extends TestCase {
|
|||
assertEquals("1", verboseEnvironmentVariable.getValue());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
try {
|
||||
testProject.delete(true, true, null);
|
||||
|
@ -74,7 +82,6 @@ public class AutotoolsEnvironmentVarTest extends TestCase {
|
|||
// FIXME: Why does a ResourceException occur when deleting the
|
||||
// project??
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,22 +10,21 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AutotoolsProjectNatureTest extends TestCase {
|
||||
|
||||
/*
|
||||
* @see TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
public class AutotoolsProjectNatureTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutotoolsProjectNature() throws Exception {
|
||||
IProject testProject = ProjectTools.createProject("testProject");
|
||||
if(testProject == null) {
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -19,16 +20,15 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AutotoolsProjectTest0 extends TestCase {
|
||||
public class AutotoolsProjectTest0 {
|
||||
|
||||
private IProject testProject;
|
||||
|
||||
/*
|
||||
* @see TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
testProject = ProjectTools.createProject("testProject0");
|
||||
|
@ -44,6 +44,7 @@ public class AutotoolsProjectTest0 extends TestCase {
|
|||
* is found in sample/hello.c.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testAutotoolsProject0() throws Exception {
|
||||
Path p = new Path("zip/project1.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, null, p, null, true);
|
||||
|
@ -68,14 +69,13 @@ public class AutotoolsProjectTest0 extends TestCase {
|
|||
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
||||
assertTrue(testProject.exists(x));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
try {
|
||||
testProject.delete(true, true, null);
|
||||
} catch (Exception e) {
|
||||
//FIXME: Why does a ResourceException occur when deleting the project??
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -19,16 +20,15 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AutotoolsProjectTest1 extends TestCase {
|
||||
public class AutotoolsProjectTest1 {
|
||||
|
||||
private IProject testProject;
|
||||
|
||||
/*
|
||||
* @see TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
testProject = ProjectTools.createProject("testProject1");
|
||||
|
@ -46,6 +46,7 @@ public class AutotoolsProjectTest1 extends TestCase {
|
|||
* Makefiles.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testAutotoolsProject1() throws Exception {
|
||||
Path p = new Path("zip/project1.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, "src", p, null, true);
|
||||
|
@ -71,14 +72,13 @@ public class AutotoolsProjectTest1 extends TestCase {
|
|||
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
||||
assertTrue(testProject.exists(x));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
try {
|
||||
testProject.delete(true, true, null);
|
||||
} catch (Exception e) {
|
||||
//FIXME: Why does a ResourceException occur when deleting the project??
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -19,18 +21,17 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
// This test verifies an autogen.sh project that builds configure, but
|
||||
// does not run it.
|
||||
public class AutotoolsProjectTest2 extends TestCase {
|
||||
public class AutotoolsProjectTest2 {
|
||||
|
||||
private IProject testProject;
|
||||
|
||||
/*
|
||||
* @see TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
testProject = ProjectTools.createProject("testProject2");
|
||||
|
@ -48,6 +49,7 @@ public class AutotoolsProjectTest2 extends TestCase {
|
|||
* Makefiles.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testAutotoolsProject2() throws Exception {
|
||||
Path p = new Path("zip/project2.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, "src", p, null);
|
||||
|
@ -84,15 +86,14 @@ public class AutotoolsProjectTest2 extends TestCase {
|
|||
x = new org.eclipse.core.runtime.Path("sample/Makefile");
|
||||
assertTrue(testProject.exists(x));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
try {
|
||||
testProject.delete(true, true, null);
|
||||
} catch (Exception e) {
|
||||
//FIXME: Why does a ResourceException occur when deleting the project??
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,19 +32,13 @@ public class AutotoolsTestsPlugin extends AbstractUIPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import java.io.File;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -24,17 +26,17 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
// This test verifies using Autotools with a linked folder.
|
||||
public class AutotoolsVirtualFolderTest extends TestCase {
|
||||
public class AutotoolsVirtualFolderTest {
|
||||
|
||||
private IProject testProject;
|
||||
|
||||
/*
|
||||
* @see TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
testProject = ProjectTools.createProject("testProjectVirtualFolder");
|
||||
|
@ -49,6 +51,7 @@ public class AutotoolsVirtualFolderTest extends TestCase {
|
|||
* Tests Bug 434275 - Autotools configuration in subfolder not found
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testAutotoolsVirtualFolder() throws Exception {
|
||||
Path p = new Path("zip/project2.zip");
|
||||
IWorkspaceRoot root = ProjectTools.getWorkspaceRoot();
|
||||
|
@ -83,14 +86,14 @@ public class AutotoolsVirtualFolderTest extends TestCase {
|
|||
return testProject.exists(new Path(path));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
try {
|
||||
testProject.delete(true, true, null);
|
||||
} catch (Exception e) {
|
||||
//FIXME: Why does a ResourceException occur when deleting the project??
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public class CoreUtility {
|
|||
final Object[] ret = new Object[1];
|
||||
final CoreException[] exc = new CoreException[1];
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ret[0] = element.createExecutableExtension(classAttribute);
|
||||
|
|
|
@ -177,10 +177,12 @@ public class ProjectTools {
|
|||
// initialize some things. The performApply() call is only needed
|
||||
// to check out referenced projects. In our test scenario, this is
|
||||
// not required.
|
||||
@Override
|
||||
public void applyOptions(IProject project, IProgressMonitor monitor) {
|
||||
setCurrentProject(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfiguration[] getSelectedConfigurations() {
|
||||
IProjectType projectType = ManagedBuildManager.getExtensionProjectType("org.eclipse.linuxtools.cdt.autotools.core.projectType"); //$NON-NLS-1$
|
||||
IConfiguration[] cfgs = projectType.getConfigurations();
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
@ -20,8 +25,6 @@ import javax.xml.parsers.DocumentBuilder;
|
|||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsOptionConstants;
|
||||
import org.eclipse.cdt.autotools.core.AutotoolsPlugin;
|
||||
import org.eclipse.cdt.autotools.core.IAutotoolsOption;
|
||||
|
@ -35,6 +38,9 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
|
@ -44,15 +50,11 @@ import org.xml.sax.SAXException;
|
|||
|
||||
// This test verifies an autogen.sh project that builds configure, but
|
||||
// does not run it.
|
||||
public class UpdateConfigureTest extends TestCase {
|
||||
public class UpdateConfigureTest {
|
||||
|
||||
private IProject testProject;
|
||||
|
||||
/*
|
||||
* @see TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
testProject = ProjectTools.createProject("testProject2");
|
||||
|
@ -67,6 +69,7 @@ public class UpdateConfigureTest extends TestCase {
|
|||
* the configure script sets both the C and C++ flags.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testGprofGcovDebugFlagOptions() throws Exception {
|
||||
Path p = new Path("zip/project2.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, "src", p, null);
|
||||
|
@ -162,6 +165,7 @@ public class UpdateConfigureTest extends TestCase {
|
|||
* contains autogen.sh which will build configure, but not run it.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testGetAndUpdateConfigureOptions() throws Exception {
|
||||
Path p = new Path("zip/project2.zip");
|
||||
ProjectTools.addSourceContainerWithImport(testProject, "src", p, null);
|
||||
|
@ -566,14 +570,14 @@ public class UpdateConfigureTest extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
testProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
try {
|
||||
testProject.delete(true, true, null);
|
||||
} catch (Exception e) {
|
||||
//FIXME: Why does a ResourceException occur when deleting the project??
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,20 +10,15 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests.autoconf;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
TestMacroParser.class,
|
||||
TestTokenizer.class,
|
||||
TestShellParser.class
|
||||
})
|
||||
public class AutoconfTests {
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(
|
||||
"Test for org.eclipse.cdt.autotools.core.tests.autoconf");
|
||||
//$JUnit-BEGIN$
|
||||
suite.addTestSuite(TestMacroParser.class);
|
||||
suite.addTestSuite(TestTokenizer.class);
|
||||
suite.addTestSuite(TestShellParser.class);
|
||||
//$JUnit-END$
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,14 +10,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests.autoconf;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfMacroDetector;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfMacroElement;
|
||||
|
@ -27,27 +30,25 @@ import org.eclipse.cdt.autotools.ui.editors.parser.IAutoconfMacroValidator;
|
|||
import org.eclipse.cdt.autotools.ui.editors.parser.ParseException;
|
||||
import org.eclipse.jface.text.Document;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.junit.Before;
|
||||
|
||||
public abstract class BaseParserTest extends TestCase {
|
||||
public abstract class BaseParserTest {
|
||||
|
||||
private IAutoconfErrorHandler errorHandler;
|
||||
protected List errors;
|
||||
protected List<ParseException> errors;
|
||||
private IAutoconfMacroValidator macroValidator;
|
||||
private Set macroNames;
|
||||
private Set<String> macroNames;
|
||||
private AutoconfMacroDetector macroDetector;
|
||||
|
||||
public BaseParserTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BaseParserTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
errors = new ArrayList();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
errors = new ArrayList<>();
|
||||
this.errorHandler = new IAutoconfErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void handleError(ParseException exception) {
|
||||
assertNotNull(exception);
|
||||
errors.add(exception);
|
||||
|
@ -57,9 +58,9 @@ public abstract class BaseParserTest extends TestCase {
|
|||
|
||||
this.macroDetector = new AutoconfMacroDetector();
|
||||
|
||||
macroNames = new HashSet/*<String>*/();
|
||||
macroNames = new HashSet<>();
|
||||
this.macroValidator = new IAutoconfMacroValidator() {
|
||||
|
||||
@Override
|
||||
public void validateMacroCall(AutoconfMacroElement element)
|
||||
throws ParseException {
|
||||
assertNotNull(element);
|
||||
|
@ -71,9 +72,6 @@ public abstract class BaseParserTest extends TestCase {
|
|||
};
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
protected IDocument createDocument(String text) {
|
||||
return new Document(text);
|
||||
}
|
||||
|
@ -146,8 +144,8 @@ public abstract class BaseParserTest extends TestCase {
|
|||
}
|
||||
|
||||
protected void checkError(String msgKey) {
|
||||
for (Iterator iter = errors.iterator(); iter.hasNext(); ) {
|
||||
ParseException exc = (ParseException) iter.next();
|
||||
for (Iterator<ParseException> iter = errors.iterator(); iter.hasNext(); ) {
|
||||
ParseException exc = iter.next();
|
||||
if (exc.getMessage().contains(msgKey))
|
||||
return;
|
||||
}
|
||||
|
@ -160,8 +158,8 @@ public abstract class BaseParserTest extends TestCase {
|
|||
protected void checkError(String msgKey, int line) {
|
||||
ParseException possible = null;
|
||||
int distance = 999;
|
||||
for (Iterator iter = errors.iterator(); iter.hasNext(); ) {
|
||||
ParseException exc = (ParseException) iter.next();
|
||||
for (Iterator<ParseException> iter = errors.iterator(); iter.hasNext(); ) {
|
||||
ParseException exc = iter.next();
|
||||
if (exc.getMessage().contains(msgKey)) {
|
||||
int curDistance = Math.abs(exc.getLineNumber() - line);
|
||||
if (curDistance < distance) {
|
||||
|
|
|
@ -11,12 +11,16 @@
|
|||
|
||||
package org.eclipse.cdt.autotools.tests.autoconf;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.eclipse.cdt.autotools.ui.editors.AutoconfEditorMessages;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfIfElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfMacroArgumentElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfMacroElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfParser;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -26,10 +30,12 @@ import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfParser;
|
|||
*/
|
||||
public class TestMacroParser extends BaseParserTest {
|
||||
|
||||
@Test
|
||||
public void testEmpty() throws Exception {
|
||||
parse("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComments() throws Exception {
|
||||
//
|
||||
String text =
|
||||
|
@ -42,6 +48,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertTreeStructure(root, new String[] {});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroParsing1() throws Exception {
|
||||
//
|
||||
String text =
|
||||
|
@ -69,6 +76,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertEqualSource("AC_REQUIRE([AM_SANITY_CHECK])", macro);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroParsing2() throws Exception {
|
||||
//
|
||||
String text =
|
||||
|
@ -98,6 +106,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertEqualSource("AC_TWO_ARGS(first,second)", macro);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroParsing3() throws Exception {
|
||||
//
|
||||
String text =
|
||||
|
@ -125,6 +134,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertEqualSource("AC_ONE_ARG( [quoted( arg ), second] )", macro);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroParsing4() throws Exception {
|
||||
//
|
||||
String text =
|
||||
|
@ -149,6 +159,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertEqualSource("[AM_AUTOMAKE_VERSION([1.4-p6])]", macro.getChildren()[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroParsing5() throws Exception {
|
||||
// check that complex shell constructs don't throw off the
|
||||
// parser, and also that we don't mistake shell tokens in a macro argument
|
||||
|
@ -193,6 +204,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroParsing6() throws Exception {
|
||||
// empty arguments
|
||||
String text =
|
||||
|
@ -215,6 +227,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertEqualSource("", macro.getChildren()[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithErrorUnmatchedLeftParen() {
|
||||
String text =
|
||||
"AC_BAD_MACRO(\n";
|
||||
|
@ -224,6 +237,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
||||
checkError(AutoconfEditorMessages.getString(AutoconfParser.UNMATCHED_LEFT_PARENTHESIS));
|
||||
}
|
||||
@Test
|
||||
public void testWithErrorUnmatchedRightParen() {
|
||||
String text =
|
||||
"AC_BAD_MACRO())\n";
|
||||
|
@ -233,6 +247,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertTrue(root.getChildren()[0] instanceof AutoconfMacroElement);
|
||||
checkError(AutoconfEditorMessages.getString(AutoconfParser.UNMATCHED_RIGHT_PARENTHESIS));
|
||||
}
|
||||
@Test
|
||||
public void testNoFalseUnmatchedRightParen() {
|
||||
String text =
|
||||
"AC_BAD_MACRO()\n" +
|
||||
|
@ -248,6 +263,7 @@ public class TestMacroParser extends BaseParserTest {
|
|||
assertTrue(root.getChildren()[1] instanceof AutoconfIfElement);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNestedMacro() {
|
||||
String text =
|
||||
"AC_1(AC_2())\n";
|
||||
|
|
|
@ -11,11 +11,15 @@
|
|||
|
||||
package org.eclipse.cdt.autotools.tests.autoconf;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.eclipse.cdt.autotools.ui.editors.AutoconfEditorMessages;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfCaseConditionElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfCaseElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfElement;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfParser;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author eswartz
|
||||
|
@ -23,6 +27,7 @@ import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfParser;
|
|||
*/
|
||||
public class TestShellParser extends BaseParserTest {
|
||||
|
||||
@Test
|
||||
public void testHERE() {
|
||||
String HERE_TEXT =
|
||||
"\n"+
|
||||
|
@ -38,7 +43,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
// only see a macro call, not a loop
|
||||
assertTreeStructure(tree, new String[] { "AM_INIT_AUTOMAKE", "confusion", "$2", "EOF", null });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHERE2() {
|
||||
String HERE_TEXT =
|
||||
"\n"+
|
||||
|
@ -55,7 +60,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertTreeStructure(tree, new String[] { "AM_INIT_AUTOMAKE", "confusion", "$2", "EOF", null });
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testIf0() {
|
||||
String text = "# comment\n"+
|
||||
"\tif true; then\n" +
|
||||
|
@ -64,7 +69,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
AutoconfElement tree = parse(text);
|
||||
assertTreeStructure(tree, new String[] { "if" });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIf1() {
|
||||
String text = "# comment\n"+
|
||||
"\tif true; then\n" +
|
||||
|
@ -74,7 +79,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertTreeStructure(tree, new String[] { "if", "AC_SOMETHING", "", null, null });
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testIfElse0() {
|
||||
String text = "# comment\n"+
|
||||
"\tif true; then\n" +
|
||||
|
@ -85,7 +90,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
AutoconfElement tree = parse(text);
|
||||
assertTreeStructure(tree, new String[] { "if", "else", null });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfElse1() {
|
||||
String text = "# comment\n"+
|
||||
"\tif true; then\n" +
|
||||
|
@ -114,6 +119,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertEqualSource("AC_ONE(...)", kids[0].getChildren()[0]);
|
||||
assertEqualSource("AC_TWO(AC_THREE())", kids[0].getChildren()[1].getChildren()[0]);
|
||||
}
|
||||
@Test
|
||||
public void testIf2() {
|
||||
String text =
|
||||
"if blah\n" +
|
||||
|
@ -121,7 +127,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
AutoconfElement tree = parse(text);
|
||||
assertTreeStructure(tree, new String[] { "if" });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfElif() {
|
||||
String text = "# comment\n"+
|
||||
"\tif true; then\n" +
|
||||
|
@ -142,7 +148,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
null,
|
||||
null });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfErr1() {
|
||||
String text =
|
||||
"if then fi\n";
|
||||
|
@ -151,6 +157,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_SPECIFIER, "then"));
|
||||
assertTreeStructure(tree, new String[] { "if" });
|
||||
}
|
||||
@Test
|
||||
public void testIfErr2() {
|
||||
String text =
|
||||
"if true; do fi\n";
|
||||
|
@ -159,6 +166,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getString(AutoconfParser.INVALID_DO));
|
||||
assertTreeStructure(tree, new String[] { "if" });
|
||||
}
|
||||
@Test
|
||||
public void testIfErr3() {
|
||||
String text =
|
||||
"if; else bar; fi\n";
|
||||
|
@ -167,6 +175,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.MISSING_SPECIFIER, "then"));
|
||||
assertTreeStructure(tree, new String[] { "if", "else", null });
|
||||
}
|
||||
@Test
|
||||
public void testIfErr4() {
|
||||
String text =
|
||||
"if true; then stmt fi\n";
|
||||
|
@ -175,6 +184,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "fi"));
|
||||
assertTreeStructure(tree, new String[] { "if" });
|
||||
}
|
||||
@Test
|
||||
public void testIfErr5() {
|
||||
String text =
|
||||
"if true; then\n";
|
||||
|
@ -183,6 +193,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "if"));
|
||||
assertTreeStructure(tree, new String[] { "if" });
|
||||
}
|
||||
@Test
|
||||
public void testIfErr6() {
|
||||
String text =
|
||||
"if true; then foo; else\n";
|
||||
|
@ -192,12 +203,14 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "else"));
|
||||
assertTreeStructure(tree, new String[] { "if", "else", null });
|
||||
}
|
||||
@Test
|
||||
public void testWhile() {
|
||||
String text =
|
||||
"while true; do foo; done\n";
|
||||
AutoconfElement tree = parse(text);
|
||||
assertTreeStructure(tree, new String[] { "while" });
|
||||
}
|
||||
@Test
|
||||
public void testWhile2() {
|
||||
String text =
|
||||
"while true\n" +
|
||||
|
@ -206,6 +219,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
AutoconfElement tree = parse(text);
|
||||
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
||||
}
|
||||
@Test
|
||||
public void testWhileErr() {
|
||||
String text =
|
||||
"while; AC_SOMETHING(...) done\n";
|
||||
|
@ -215,6 +229,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.INVALID_TERMINATION, "done"));
|
||||
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
||||
}
|
||||
@Test
|
||||
public void testWhileErr2() {
|
||||
String text =
|
||||
"while true; do AC_SOMETHING(...)\n";
|
||||
|
@ -223,7 +238,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
checkError(AutoconfEditorMessages.getFormattedString(AutoconfParser.UNTERMINATED_CONSTRUCT, "while"));
|
||||
assertTreeStructure(tree, new String[] { "while", "AC_SOMETHING", "...", null, null });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCase() {
|
||||
String text =
|
||||
"case $VAL in\n"+
|
||||
|
@ -271,7 +286,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertEquals(0, caseCond.getChildren().length);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCaseErr() {
|
||||
String text =
|
||||
"case $VAL; linux-*-*) AC_FIRST($VAL) ; true esac\n";
|
||||
|
@ -290,6 +305,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertEqualSource("AC_FIRST($VAL)", caseCond.getChildren()[0]);
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testCaseErr2() {
|
||||
String text =
|
||||
"case $VAL in\n";
|
||||
|
@ -300,7 +316,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertTreeStructure(tree, new String[] { "case" });
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForIn() {
|
||||
// don't get upset by 'in'
|
||||
String text =
|
||||
|
@ -314,7 +330,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertEqualSource(text.substring(0, text.length()-1), forEl);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForDo() {
|
||||
// don't get upset by parentheses
|
||||
String text =
|
||||
|
@ -324,15 +340,14 @@ public class TestShellParser extends BaseParserTest {
|
|||
assertTreeStructure(tree, new String[] { "for", "AC_1", "AC_2", "", null, "AC_3", "...", null, null });
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUntil() {
|
||||
String text =
|
||||
"until false; do AC_SOMETHING(...); done\n";
|
||||
AutoconfElement tree = parse(text, false);
|
||||
assertTreeStructure(tree, new String[] { "until", "AC_SOMETHING", "...", null, null });
|
||||
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testSelect() {
|
||||
String text =
|
||||
"select VAR in 1 2 3; do AC_SOMETHING(...); done\n"+
|
||||
|
@ -350,7 +365,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
null
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComplex1() {
|
||||
String text =
|
||||
"AM_INIT_AUTOMAKE([foo1], 1.96)\n" +
|
||||
|
@ -379,7 +394,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
null
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComplex2() {
|
||||
String text =
|
||||
"if true; then\n" +
|
||||
|
@ -401,7 +416,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
null
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEarlyClose() {
|
||||
String text =
|
||||
"if true; then foo ; fi\n"+
|
||||
|
@ -413,7 +428,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
"while"
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverlapping() {
|
||||
String text =
|
||||
"for foo\n"+
|
||||
|
@ -424,7 +439,7 @@ public class TestShellParser extends BaseParserTest {
|
|||
"if"
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDollar() {
|
||||
// dollars guard keywords
|
||||
String text =
|
||||
|
|
|
@ -11,11 +11,14 @@
|
|||
|
||||
package org.eclipse.cdt.autotools.tests.autoconf;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.AutoconfTokenizer;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.IAutoconfErrorHandler;
|
||||
import org.eclipse.cdt.autotools.ui.editors.parser.ITokenConstants;
|
||||
|
@ -23,6 +26,7 @@ import org.eclipse.cdt.autotools.ui.editors.parser.ParseException;
|
|||
import org.eclipse.cdt.autotools.ui.editors.parser.Token;
|
||||
import org.eclipse.jface.text.Document;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -31,34 +35,22 @@ import org.eclipse.jface.text.IDocument;
|
|||
* @author eswartz
|
||||
*
|
||||
*/
|
||||
public class TestTokenizer extends TestCase {
|
||||
public class TestTokenizer {
|
||||
|
||||
private ArrayList tokenizerErrors;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.TestCase#tearDown()
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
}
|
||||
private ArrayList<ParseException> tokenizerErrors;
|
||||
|
||||
protected IDocument createDocument(String text) {
|
||||
return new Document(text);
|
||||
}
|
||||
|
||||
protected List/*<Token>*/tokenize(IDocument document) {
|
||||
protected List<Token> tokenize(IDocument document) {
|
||||
return tokenize(document, false);
|
||||
}
|
||||
|
||||
protected List/*<Token>*/tokenize(IDocument document, boolean isM4Mode) {
|
||||
tokenizerErrors = new ArrayList();
|
||||
protected List<Token> tokenize(IDocument document, boolean isM4Mode) {
|
||||
tokenizerErrors = new ArrayList<>();
|
||||
AutoconfTokenizer tokenizer = new AutoconfTokenizer(document, new IAutoconfErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void handleError(ParseException exception) {
|
||||
tokenizerErrors.add(exception);
|
||||
}
|
||||
|
@ -66,12 +58,12 @@ public class TestTokenizer extends TestCase {
|
|||
});
|
||||
tokenizer.setM4Context(isM4Mode);
|
||||
|
||||
List/*<Token>*/ tokens = tokenize(tokenizer);
|
||||
List<Token> tokens = tokenize(tokenizer);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
protected List/*<Token>*/tokenize(AutoconfTokenizer tokenizer) {
|
||||
List/*<Token>*/tokens = new ArrayList();
|
||||
protected List<Token> tokenize(AutoconfTokenizer tokenizer) {
|
||||
List<Token> tokens = new ArrayList<>();
|
||||
while (true) {
|
||||
Token token = tokenizer.readToken();
|
||||
if (token.getType() == ITokenConstants.EOF)
|
||||
|
@ -84,242 +76,246 @@ public class TestTokenizer extends TestCase {
|
|||
protected void checkNoErrors() {
|
||||
assertEquals(0, tokenizerErrors.size());
|
||||
}
|
||||
@Test
|
||||
public void testEmpty() {
|
||||
IDocument document = createDocument("");
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(0, tokens.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEOL1() {
|
||||
IDocument document = createDocument("\n");
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(1, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEOL2() {
|
||||
IDocument document = createDocument("\r\n");
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(1, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.EOL, "\r\n");
|
||||
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\r\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEOL3() {
|
||||
IDocument document = createDocument("\n\r\n\n");
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(3, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.EOL, "\n");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.EOL, "\r\n");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\r\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellText() {
|
||||
// default mode is shell
|
||||
String text = "random\nstuff\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(4, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"random");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.WORD,
|
||||
"stuff");
|
||||
checkToken((Token) tokens.get(3), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(3), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellTokens() {
|
||||
// default mode is shell
|
||||
String text = "while true; do ls; done\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(8, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.SH_WHILE,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.SH_WHILE,
|
||||
"while");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.WORD,
|
||||
"true");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.SEMI, ";");
|
||||
checkToken((Token) tokens.get(3), document, ITokenConstants.SH_DO, "do");
|
||||
checkToken((Token) tokens.get(4), document, ITokenConstants.WORD, "ls");
|
||||
checkToken((Token) tokens.get(5), document, ITokenConstants.SEMI, ";");
|
||||
checkToken((Token) tokens.get(6), document, ITokenConstants.SH_DONE,
|
||||
checkToken(tokens.get(2), document, ITokenConstants.SEMI, ";");
|
||||
checkToken(tokens.get(3), document, ITokenConstants.SH_DO, "do");
|
||||
checkToken(tokens.get(4), document, ITokenConstants.WORD, "ls");
|
||||
checkToken(tokens.get(5), document, ITokenConstants.SEMI, ";");
|
||||
checkToken(tokens.get(6), document, ITokenConstants.SH_DONE,
|
||||
"done");
|
||||
checkToken((Token) tokens.get(7), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(7), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellTokens2() {
|
||||
// don't misread partial tokens
|
||||
String text = "while_stuff incase";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(2, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"while_stuff");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.WORD,
|
||||
"incase");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellTokens3() {
|
||||
// don't interpret m4 strings in shell mode
|
||||
String text = "`foo'";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
assertEquals(1, tokenizerErrors.size());
|
||||
assertEquals(1, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.SH_STRING_BACKTICK, "foo'", 5);
|
||||
checkToken(tokens.get(0), document, ITokenConstants.SH_STRING_BACKTICK, "foo'", 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellTokens4() {
|
||||
String text = "echo $if $((foo)) $\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(11, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD, "echo");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.SH_DOLLAR, "$");
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD, "echo");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.SH_DOLLAR, "$");
|
||||
// dollar guards keywords, but the tokenizer doesn't know this
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.SH_IF, "if");
|
||||
checkToken((Token) tokens.get(3), document, ITokenConstants.SH_DOLLAR, "$");
|
||||
checkToken((Token) tokens.get(4), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken((Token) tokens.get(5), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken((Token) tokens.get(6), document, ITokenConstants.WORD, "foo");
|
||||
checkToken((Token) tokens.get(7), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken((Token) tokens.get(8), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken((Token) tokens.get(9), document, ITokenConstants.SH_DOLLAR, "$");
|
||||
checkToken((Token) tokens.get(10), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.SH_IF, "if");
|
||||
checkToken(tokens.get(3), document, ITokenConstants.SH_DOLLAR, "$");
|
||||
checkToken(tokens.get(4), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken(tokens.get(5), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken(tokens.get(6), document, ITokenConstants.WORD, "foo");
|
||||
checkToken(tokens.get(7), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken(tokens.get(8), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken(tokens.get(9), document, ITokenConstants.SH_DOLLAR, "$");
|
||||
checkToken(tokens.get(10), document, ITokenConstants.EOL, "\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellTokens5() {
|
||||
String text = "while do select for until done\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(7, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.SH_WHILE, "while");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.SH_DO, "do");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.SH_SELECT, "select");
|
||||
checkToken((Token) tokens.get(3), document, ITokenConstants.SH_FOR, "for");
|
||||
checkToken((Token) tokens.get(4), document, ITokenConstants.SH_UNTIL, "until");
|
||||
checkToken((Token) tokens.get(5), document, ITokenConstants.SH_DONE, "done");
|
||||
checkToken((Token) tokens.get(6), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(0), document, ITokenConstants.SH_WHILE, "while");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.SH_DO, "do");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.SH_SELECT, "select");
|
||||
checkToken(tokens.get(3), document, ITokenConstants.SH_FOR, "for");
|
||||
checkToken(tokens.get(4), document, ITokenConstants.SH_UNTIL, "until");
|
||||
checkToken(tokens.get(5), document, ITokenConstants.SH_DONE, "done");
|
||||
checkToken(tokens.get(6), document, ITokenConstants.EOL, "\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellComments() {
|
||||
// comments are stripped and ignored in the shell mode
|
||||
String text = "for # while case\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(2, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.SH_FOR,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.SH_FOR,
|
||||
"for");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellComments2() {
|
||||
// comments are stripped and ignored in the shell mode
|
||||
String text = "# while case\n" + "#for x in 3\n" + "\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(3, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.EOL, "\n");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(0), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM4Tokens0() {
|
||||
String text = "while_stuff incase";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, true);
|
||||
List<Token> tokens = tokenize(document, true);
|
||||
checkNoErrors();
|
||||
assertEquals(2, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"while_stuff");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.WORD,
|
||||
"incase");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShellStrings() {
|
||||
String QUOTED =
|
||||
"ls -la \"*.c\"";
|
||||
String text = "echo `" + QUOTED + "`\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(3, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"echo");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.SH_STRING_BACKTICK,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_BACKTICK,
|
||||
QUOTED, QUOTED.length() + 2);
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
@Test
|
||||
public void testShellStrings2() {
|
||||
String QUOTED =
|
||||
"ls -la 'space file'";
|
||||
String text = "echo \"" + QUOTED + "\"\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(3, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"echo");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.SH_STRING_DOUBLE,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_DOUBLE,
|
||||
QUOTED, QUOTED.length() + 2);
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
@Test
|
||||
public void testShellStrings3() {
|
||||
String QUOTED =
|
||||
"echo \"*.c\" | sed s/[a-z]/[A-Z]/g";
|
||||
String text = "echo '" + QUOTED + "'\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, false);
|
||||
List<Token> tokens = tokenize(document, false);
|
||||
checkNoErrors();
|
||||
assertEquals(3, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"echo");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.SH_STRING_SINGLE,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.SH_STRING_SINGLE,
|
||||
QUOTED, QUOTED.length() + 2);
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
@Test
|
||||
public void testM4Tokens1() {
|
||||
String text = "define(`hi\', `HI\')\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, true);
|
||||
List<Token> tokens = tokenize(document, true);
|
||||
checkNoErrors();
|
||||
assertEquals(7, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"define");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||
// strings are unquoted in token text
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.M4_STRING,
|
||||
checkToken(tokens.get(2), document, ITokenConstants.M4_STRING,
|
||||
"hi", 4);
|
||||
checkToken((Token) tokens.get(3), document, ITokenConstants.COMMA, ",");
|
||||
checkToken((Token) tokens.get(4), document, ITokenConstants.M4_STRING,
|
||||
checkToken(tokens.get(3), document, ITokenConstants.COMMA, ",");
|
||||
checkToken(tokens.get(4), document, ITokenConstants.M4_STRING,
|
||||
"HI", 4);
|
||||
checkToken((Token) tokens.get(5), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken((Token) tokens.get(6), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(5), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken(tokens.get(6), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM4Comments() {
|
||||
String text = "dnl # comment\n";
|
||||
IDocument document = createDocument(text);
|
||||
List tokens = tokenize(document, true);
|
||||
List<Token> tokens = tokenize(document, true);
|
||||
checkNoErrors();
|
||||
assertEquals(2, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.M4_COMMENT,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.M4_COMMENT,
|
||||
"# comment\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM4Comments2() {
|
||||
String text = "dnl /* word(`quoted')\n" + "*/\n";
|
||||
IDocument document = createDocument(text);
|
||||
|
@ -327,14 +323,14 @@ public class TestTokenizer extends TestCase {
|
|||
tokenizer.setM4Context(true);
|
||||
tokenizer.setM4Comment("/*", "*/");
|
||||
|
||||
List tokens = tokenize(tokenizer);
|
||||
List<Token> tokens = tokenize(tokenizer);
|
||||
assertEquals(3, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.M4_COMMENT,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD, "dnl");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.M4_COMMENT,
|
||||
"/* word(`quoted')\n*/");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM4Strings1() {
|
||||
// double quotes only removes one level of quotes
|
||||
String text = "``double''\n";
|
||||
|
@ -342,13 +338,13 @@ public class TestTokenizer extends TestCase {
|
|||
AutoconfTokenizer tokenizer = createTokenizer(document);
|
||||
tokenizer.setM4Context(true);
|
||||
|
||||
List tokens = tokenize(tokenizer);
|
||||
List<Token> tokens = tokenize(tokenizer);
|
||||
assertEquals(2, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.M4_STRING,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.M4_STRING,
|
||||
"`double'", 8 + 1 + 1);
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM4Strings2() {
|
||||
String text = "myword(!!boundary==)\n";
|
||||
IDocument document = createDocument(text);
|
||||
|
@ -356,17 +352,17 @@ public class TestTokenizer extends TestCase {
|
|||
tokenizer.setM4Context(true);
|
||||
tokenizer.setM4Quote("!!", "==");
|
||||
|
||||
List tokens = tokenize(tokenizer);
|
||||
List<Token> tokens = tokenize(tokenizer);
|
||||
assertEquals(5, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"myword");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.M4_STRING,
|
||||
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.M4_STRING,
|
||||
"boundary", 8 + 2 + 2);
|
||||
checkToken((Token) tokens.get(3), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken((Token) tokens.get(4), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(3), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken(tokens.get(4), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM4Tokens2() {
|
||||
// dollar is not seen in m4 mode (only important when expanding)
|
||||
String text = "define(foo,$1)\n";
|
||||
|
@ -374,19 +370,19 @@ public class TestTokenizer extends TestCase {
|
|||
AutoconfTokenizer tokenizer = createTokenizer(document);
|
||||
tokenizer.setM4Context(true);
|
||||
|
||||
List tokens = tokenize(tokenizer);
|
||||
List<Token> tokens = tokenize(tokenizer);
|
||||
assertEquals(8, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.WORD,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.WORD,
|
||||
"define");
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken((Token) tokens.get(2), document, ITokenConstants.WORD, "foo");
|
||||
checkToken((Token) tokens.get(3), document, ITokenConstants.COMMA, ",");
|
||||
checkToken((Token) tokens.get(4), document, ITokenConstants.TEXT, "$");
|
||||
checkToken((Token) tokens.get(5), document, ITokenConstants.TEXT, "1");
|
||||
checkToken((Token) tokens.get(6), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken((Token) tokens.get(7), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.LPAREN, "(");
|
||||
checkToken(tokens.get(2), document, ITokenConstants.WORD, "foo");
|
||||
checkToken(tokens.get(3), document, ITokenConstants.COMMA, ",");
|
||||
checkToken(tokens.get(4), document, ITokenConstants.TEXT, "$");
|
||||
checkToken(tokens.get(5), document, ITokenConstants.TEXT, "1");
|
||||
checkToken(tokens.get(6), document, ITokenConstants.RPAREN, ")");
|
||||
checkToken(tokens.get(7), document, ITokenConstants.EOL, "\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM4QuoteNesting() {
|
||||
String quote = "this is `nested\'!";
|
||||
String text = "`" + quote +"'\n";
|
||||
|
@ -394,14 +390,14 @@ public class TestTokenizer extends TestCase {
|
|||
AutoconfTokenizer tokenizer = createTokenizer(document);
|
||||
tokenizer.setM4Context(true);
|
||||
|
||||
List tokens = tokenize(tokenizer);
|
||||
List<Token> tokens = tokenize(tokenizer);
|
||||
assertEquals(2, tokens.size());
|
||||
checkToken((Token) tokens.get(0), document, ITokenConstants.M4_STRING,
|
||||
checkToken(tokens.get(0), document, ITokenConstants.M4_STRING,
|
||||
quote, quote.length() + 2);
|
||||
checkToken((Token) tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
checkToken(tokens.get(1), document, ITokenConstants.EOL, "\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMixedContext() {
|
||||
String text = "AM_INIT([arg])if true\n";
|
||||
IDocument document = createDocument(text);
|
||||
|
@ -449,7 +445,7 @@ public class TestTokenizer extends TestCase {
|
|||
|
||||
private AutoconfTokenizer createTokenizer(IDocument document) {
|
||||
return new AutoconfTokenizer(document, new IAutoconfErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void handleError(ParseException exception) {
|
||||
fail(exception.toString());
|
||||
}
|
||||
|
|
|
@ -10,8 +10,18 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests.editors;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.eclipse.cdt.autotools.tests.AutotoolsTestsPlugin;
|
||||
import org.eclipse.cdt.autotools.tests.ProjectTools;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeDocumentProvider;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeEditor;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakefileCodeScanner;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakefileSourceConfiguration;
|
||||
import org.eclipse.cdt.internal.autotools.ui.preferences.ColorManager;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
@ -20,20 +30,15 @@ import org.eclipse.jface.text.ITypedRegion;
|
|||
import org.eclipse.jface.text.TextAttribute;
|
||||
import org.eclipse.jface.text.rules.IToken;
|
||||
import org.eclipse.jface.text.rules.Token;
|
||||
import org.eclipse.cdt.autotools.tests.AutotoolsTestsPlugin;
|
||||
import org.eclipse.cdt.autotools.tests.ProjectTools;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeDocumentProvider;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeEditor;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakefileCodeScanner;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakefileSourceConfiguration;
|
||||
import org.eclipse.cdt.internal.autotools.ui.preferences.ColorManager;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class AutomakeColourizationTests extends TestCase {
|
||||
public class AutomakeColourizationTests {
|
||||
|
||||
ProjectTools tools;
|
||||
private IProject project;
|
||||
|
@ -51,8 +56,8 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
private IWorkbench workbench;
|
||||
private AutomakefileCodeScanner codeScanner;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
tools = new ProjectTools();
|
||||
if (!ProjectTools.setup())
|
||||
fail("could not perform basic project workspace setup");
|
||||
|
@ -67,7 +72,8 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
makefileAmFile = tools.createFile(project, "Makefile.am", makefileAmContents);
|
||||
workbench = AutotoolsTestsPlugin.getDefault().getWorkbench();
|
||||
|
@ -96,7 +102,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
IToken getNextToken() {
|
||||
return codeScanner.nextToken();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutomakeEditorColourization() throws Exception {
|
||||
// # This is a comment
|
||||
IToken token0 = getNextToken();
|
||||
|
@ -106,7 +112,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
Token token = (Token) token0;
|
||||
TextAttribute ta = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_COMMENT_RGB, ((Color) ta.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_COMMENT_RGB, ta.getForeground().getRGB());
|
||||
|
||||
// if CONDITION
|
||||
token0 = getNextToken();
|
||||
|
@ -116,7 +122,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
token = (Token) token0;
|
||||
TextAttribute attribute = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_KEYWORD_RGB, ((Color) attribute.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_KEYWORD_RGB, attribute.getForeground().getRGB());
|
||||
|
||||
// blank space between "if" and "CONDITION"
|
||||
token0 = getNextToken();
|
||||
|
@ -136,7 +142,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
token = (Token) token0;
|
||||
attribute = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_DEFAULT_RGB, ((Color) attribute.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_DEFAULT_RGB, attribute.getForeground().getRGB());
|
||||
|
||||
// line break
|
||||
token0 = getNextToken();
|
||||
|
@ -156,7 +162,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
token = (Token) token0;
|
||||
attribute = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_MACRO_DEF_RGB, ((Color) attribute.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_MACRO_DEF_RGB, attribute.getForeground().getRGB());
|
||||
|
||||
// else
|
||||
token0 = getNextToken();
|
||||
|
@ -166,7 +172,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
token = (Token) token0;
|
||||
attribute = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_KEYWORD_RGB, ((Color) attribute.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_KEYWORD_RGB, attribute.getForeground().getRGB());
|
||||
|
||||
// line break
|
||||
token0 = getNextToken();
|
||||
|
@ -186,7 +192,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
token = (Token) token0;
|
||||
attribute = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_MACRO_DEF_RGB, ((Color) attribute.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_MACRO_DEF_RGB, attribute.getForeground().getRGB());
|
||||
|
||||
// $(MACRO)
|
||||
token0 = getNextToken();
|
||||
|
@ -196,7 +202,7 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
token = (Token) token0;
|
||||
attribute = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_MACRO_REF_RGB, ((Color) attribute.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_MACRO_REF_RGB, attribute.getForeground().getRGB());
|
||||
|
||||
// line break
|
||||
token0 = getNextToken();
|
||||
|
@ -216,11 +222,10 @@ public class AutomakeColourizationTests extends TestCase {
|
|||
|
||||
token = (Token) token0;
|
||||
attribute = (TextAttribute) token.getData();
|
||||
assertEquals(ColorManager.MAKE_MACRO_REF_RGB, ((Color) attribute.getForeground()).getRGB());
|
||||
assertEquals(ColorManager.MAKE_MACRO_REF_RGB, attribute.getForeground().getRGB());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
project.delete(true, false, ProjectTools.getMonitor());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,18 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests.editors;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.cdt.autotools.tests.AutotoolsTestsPlugin;
|
||||
import org.eclipse.cdt.autotools.tests.ProjectTools;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeEditor;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class AutomakeEditorTests extends TestCase {
|
||||
|
||||
|
|
|
@ -10,24 +10,24 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests.editors;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.cdt.autotools.tests.AutotoolsTestsPlugin;
|
||||
import org.eclipse.cdt.autotools.tests.ProjectTools;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeDocumentProvider;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeEditor;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakeTextHover;
|
||||
import org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakefileSourceConfiguration;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class AutomakeTextHoverTest extends TestCase {
|
||||
|
||||
|
|
|
@ -10,20 +10,14 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.autotools.tests.editors;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
AutomakeColourizationTests.class,
|
||||
AutomakeTextHoverTest.class,
|
||||
AutomakeEditorTests.class
|
||||
})
|
||||
public class EditorTests {
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(
|
||||
"Test for org.eclipse.cdt.autotools.core.tests.editors");
|
||||
//$JUnit-BEGIN$
|
||||
suite.addTestSuite(AutomakeColourizationTests.class);
|
||||
suite.addTestSuite(AutomakeTextHoverTest.class);
|
||||
suite.addTestSuite(AutomakeEditorTests.class);
|
||||
//$JUnit-END$
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue