Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.dltk.sh.ui.tests')
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/.classpath7
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/.project34
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.core.prefs113
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.ui.prefs54
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/META-INF/MANIFEST.MF10
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/about.html28
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/build.properties6
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/pom.xml58
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/tests/AllTests.java24
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AbstractScannerTester.java71
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AssignmentRuleTest.java61
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarBraceCountingRuleTest.java84
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarRuleTest.java95
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DoubleQuoteScannerTest.java111
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/EvalScannerTest.java73
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/MockScanner.java69
-rw-r--r--tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/TextSuite.java24
17 files changed, 922 insertions, 0 deletions
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/.classpath b/tests/org.eclipse.dltk.sh.ui.tests/.classpath
new file mode 100644
index 0000000..098194c
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/.project b/tests/org.eclipse.dltk.sh.ui.tests/.project
new file mode 100644
index 0000000..06c0601
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.dltk.sh.ui.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..091b39b
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,113 @@
+eclipse.preferences.version=1
+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.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+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.doc.comment.support=enabled
+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=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
+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=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+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=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+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=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
+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=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..1bca2f0
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,54 @@
+#Fri Dec 11 14:15:17 EET 2009
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+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_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_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+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=true
+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_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_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+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
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.dltk.sh.ui.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..d383469
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests for the ShellEd UI plugin
+Bundle-SymbolicName: org.eclipse.dltk.sh.ui.tests
+Bundle-Version: 5.3.1.qualifier
+Require-Bundle: org.junit;bundle-version="4.10.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Fragment-Host: org.eclipse.dltk.sh.ui
+Bundle-Vendor: Eclipse.org \ No newline at end of file
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/about.html b/tests/org.eclipse.dltk.sh.ui.tests/about.html
new file mode 100644
index 0000000..7c8477f
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/build.properties b/tests/org.eclipse.dltk.sh.ui.tests/build.properties
new file mode 100644
index 0000000..9cbab3c
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/pom.xml b/tests/org.eclipse.dltk.sh.ui.tests/pom.xml
new file mode 100644
index 0000000..87b3429
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2011, Red Hat, Inc. All rights reserved. This program and the
+ accompanying materials are made available under the terms of the Eclipse Public License
+ v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.dltk.sh</groupId>
+ <artifactId>parent</artifactId>
+ <version>5.3.1-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.dltk.sh.ui.tests</artifactId>
+ <version>5.3.1-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <name>ShellEd UI test plugin</name>
+ <properties>
+ <os-jvm-flags></os-jvm-flags>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <excludes>
+ <!-- test mojo matches TestProject be default and treats it as PojoTest -->
+ <exclude>**/Test*.class</exclude>
+ </excludes>
+ <argLine>${os-jvm-flags} ${tycho.testArgLine}</argLine>
+ <testSuite>org.eclipse.dltk.sh.ui.tests</testSuite>
+ <testClass>org.eclipse.dltk.sh.ui.tests.AllTests</testClass>
+ <useUIHarness>true</useUIHarness>
+ <useUIThread>true</useUIThread>
+ <product>org.eclipse.platform.ide</product>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>macosx-jvm-flags</id>
+ <activation>
+ <os>
+ <family>mac</family>
+ </os>
+ </activation>
+ <properties>
+ <os-jvm-flags>-XstartOnFirstThread</os-jvm-flags>
+ </properties>
+ </profile>
+ </profiles>
+</project>
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/tests/AllTests.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/tests/AllTests.java
new file mode 100644
index 0000000..e05d387
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/tests/AllTests.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Kurtakov - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.tests;
+
+import org.eclipse.dltk.sh.ui.text.tests.TextSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * All tests wrapper.
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ TextSuite.class })
+public class AllTests {
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AbstractScannerTester.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AbstractScannerTester.java
new file mode 100644
index 0000000..14a2818
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AbstractScannerTester.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mat Booth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import org.eclipse.dltk.internal.ui.text.DLTKColorManager;
+import org.eclipse.dltk.ui.text.IColorManager;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.junit.Before;
+
+/**
+ * Common base class for rules-based scanner tests.
+ */
+@SuppressWarnings("restriction")
+public abstract class AbstractScannerTester {
+
+ protected IColorManager cm = new DLTKColorManager();
+ protected RuleBasedScanner scanner;
+
+ /**
+ * Reset the scanner before every test.
+ */
+ @Before
+ public void setup() {
+ scanner = getScanner();
+ scanner.setRange(new Document(getText()), 0, getText().length());
+ }
+
+ /**
+ * To be implemented by the test.
+ *
+ * @return an instance of the scanner under test
+ */
+ protected abstract RuleBasedScanner getScanner();
+
+ /**
+ * To be implemented by the test.
+ *
+ * @return the text that will be used to test the scanner
+ */
+ protected abstract String getText();
+
+ /**
+ * Gets the nth token from the scanner's document.
+ *
+ * @param n
+ * 1 for the very next token, 2 for the token after that, etc
+ * @return the nth token
+ */
+ protected IToken getNthToken(int n) {
+ for (int i = 0; i < n - 1; i++) {
+ scanner.nextToken();
+ }
+ return scanner.nextToken();
+ }
+
+ /**
+ * Gets the very next token from the scanner's document.
+ *
+ * @return the next token
+ */
+ protected IToken getNextToken() {
+ return getNthToken(1);
+ }
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AssignmentRuleTest.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AssignmentRuleTest.java
new file mode 100644
index 0000000..8d2dff1
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/AssignmentRuleTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mat Booth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mat Booth
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import org.eclipse.dltk.sh.ui.text.AssignmentDetector;
+import org.eclipse.dltk.sh.ui.text.AssignmentRule;
+import org.eclipse.dltk.sh.ui.text.IShellPartitions;
+import org.eclipse.jface.text.rules.Token;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests the assignment rule that detects variable assignments.
+ */
+public class AssignmentRuleTest {
+
+ // Mock objects
+ private MockScanner fScanner;
+
+ // Objects under test
+ private static AssignmentRule fRule = new AssignmentRule(new AssignmentDetector(),
+ Token.UNDEFINED, new Token(IShellPartitions.PARAM_CONTENT_TYPE));
+
+ /**
+ * Match simple variable assignments.
+ */
+ @Test
+ public void testAssignmentMatch() {
+ fScanner = new MockScanner("VAR=assignment");
+ Assert.assertFalse(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("VAR", fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ }
+
+ /**
+ * Match assignments to shell array variable indexes.
+ */
+ @Test
+ public void testArrayIndexAssignmentMatch() {
+ fScanner = new MockScanner("VAR[2]=assignment");
+ Assert.assertFalse(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("VAR[2]", fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ }
+
+ /**
+ * The equals MUST immediately follow the var-name, otherwise don't match.
+ */
+ @Test
+ public void testNonAssignmentMatch() {
+ fScanner = new MockScanner("VAR = assignment");
+ Assert.assertTrue(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("", fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ }
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarBraceCountingRuleTest.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarBraceCountingRuleTest.java
new file mode 100644
index 0000000..e6d73f3
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarBraceCountingRuleTest.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Mat Booth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import org.eclipse.dltk.sh.ui.text.DollarBraceCountingRule;
+import org.eclipse.dltk.sh.ui.text.IShellPartitions;
+import org.eclipse.jface.text.rules.Token;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests the dollar-prefixed brace-counting single-line rule. Basically we're
+ * testing to make sure syntax highlighting is correct for ${} and $() blocks.
+ */
+public class DollarBraceCountingRuleTest {
+
+ // Mock objects
+ private MockScanner fScanner;
+
+ // Objects under test
+ private static DollarBraceCountingRule fRule = new DollarBraceCountingRule(
+ '{', '}', new Token(IShellPartitions.PARAM_CONTENT_TYPE), '\\');
+
+ /**
+ * Highlight a simple pair of dollar-prefixed braces.
+ */
+ @Test
+ public void testSimpleMatch() {
+ fScanner = new MockScanner("${basic}test}");
+ Assert.assertFalse(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("${basic}", fScanner.getBuffer().substring(0,
+ fScanner.getOffset()));
+ }
+
+ /**
+ * Highlight a pair of braces enclosing escaped braces.
+ */
+ @Test
+ public void testEscapedBraceMatch() {
+ fScanner = new MockScanner("${basic\\}\\}}test}");
+ Assert.assertFalse(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("${basic\\}\\}}", fScanner.getBuffer().substring(0,
+ fScanner.getOffset()));
+ }
+
+ /**
+ * Highlight the correct amount of nested braces.
+ */
+ @Test
+ public void testNestedBraceMatch() {
+ fScanner = new MockScanner("${a{b{cd}e}f}g}");
+ Assert.assertFalse(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("${a{b{cd}e}f}", fScanner.getBuffer().substring(0,
+ fScanner.getOffset()));
+ }
+
+ /**
+ * Highlight everything up to the end of the line, if that occurs before the
+ * final closing brace.
+ */
+ @Test
+ public void testEndOfLineMatch() {
+ fScanner = new MockScanner("${a{b}c\nd}");
+ Assert.assertFalse(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("${a{b}c\n", fScanner.getBuffer().substring(0,
+ fScanner.getOffset()));
+ }
+
+ /**
+ * Do not highlight if EOF interrupts the pattern.
+ */
+ @Test
+ public void testEndOfFileMatch() {
+ fScanner = new MockScanner("${end of file is here:");
+ Assert.assertTrue(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("", fScanner.getBuffer().substring(0,
+ fScanner.getOffset()));
+ }
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarRuleTest.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarRuleTest.java
new file mode 100644
index 0000000..bab52c4
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DollarRuleTest.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Kurtakov - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import org.eclipse.dltk.sh.ui.text.DollarDetector;
+import org.eclipse.dltk.sh.ui.text.DollarRule;
+import org.eclipse.dltk.sh.ui.text.IShellPartitions;
+import org.eclipse.jface.text.rules.Token;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests the dollar rule that detects $var style parameter expansions.
+ */
+public class DollarRuleTest {
+
+ // Mock objects
+ private MockScanner fScanner;
+
+ // Objects under test
+ private static DollarRule fRule = new DollarRule(new DollarDetector(), Token.UNDEFINED,
+ new Token(IShellPartitions.PARAM_CONTENT_TYPE));
+
+ /**
+ * Don't match ${} syntax because that is taken care of in another rule.
+ */
+ @Test
+ public void testDollarBraceMatch() {
+ fScanner = new MockScanner("${braces}");
+ Assert.assertTrue(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("", fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ }
+
+ /**
+ * Match simple alpha-numeric vars that may contain underscores. Don't match
+ * [ or ] because array index references must be inside braces.
+ */
+ @Test
+ public void testDollarMatch() {
+ fScanner = new MockScanner("$alpha_01[5] numeric vars");
+ Assert.assertFalse(fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("$alpha_01", fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ }
+
+ /**
+ * If the variable starts with a digit, then it's a reference to a
+ * positional parameter and only that one digit may be highlighted
+ * (characters after the digit are ignored and parameters 10+ must be
+ * referenced using the brace syntax.) Special parameters are detected
+ * similarly.
+ */
+ @Test
+ public void testPositionalSpecialMatch() {
+ // List of valid special or positional parameters
+ char specials[] = new char[] { '*', '@', '#', '?', '-', '$', '!', '_', '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', };
+ for (int i = '!'; i <= '~'; i++) {
+ String s = "$" + Character.toString((char) i);
+ fScanner = new MockScanner(s + "some more text");
+
+ // Make sure that special/positional parameters are matched
+ // correctly
+ boolean isSpecial = false;
+ for (int j = 0; j < specials.length; j++) {
+ if ((char) i == specials[j]) {
+ Assert.assertFalse("Testing Special " + s, fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals(s, fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ isSpecial = true;
+ break;
+ }
+ }
+
+ if (!isSpecial) {
+ if (Character.isLetter((char) i)) {
+ // Make sure that valid characters that are not specials are
+ // matched normally
+ Assert.assertFalse("Testing Not Special " + s, fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals(s + "some", fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ } else {
+ // Make sure that invalid characters are not matched at all
+ Assert.assertTrue("Testing Not Special " + s, fRule.evaluate(fScanner).isUndefined());
+ Assert.assertEquals("", fScanner.getBuffer().substring(0, fScanner.getOffset()));
+ }
+ }
+ }
+ }
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DoubleQuoteScannerTest.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DoubleQuoteScannerTest.java
new file mode 100644
index 0000000..3ab6f03
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/DoubleQuoteScannerTest.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mat Booth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.dltk.sh.ui.Activator;
+import org.eclipse.dltk.sh.ui.IShellColorConstants;
+import org.eclipse.dltk.sh.ui.text.DoubleQuoteScanner;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.junit.Test;
+
+/**
+ * Test the scanner for double quote partitions.
+ */
+public class DoubleQuoteScannerTest extends AbstractScannerTester {
+
+ @Override
+ protected RuleBasedScanner getScanner() {
+ return new DoubleQuoteScanner(cm, Activator.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected String getText() {
+ return "x${var}x$var`eval`x$(eval)";
+ }
+
+ /**
+ * Tests that we correctly highlight $dollar style parameter expansions
+ * within interpolated strings.
+ */
+ @Test
+ public void testDollar() {
+ IToken token = getNthToken(4);
+ assertEquals(4, scanner.getTokenLength());
+ assertEquals(8, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_VARIABLE));
+ }
+
+ /**
+ * Tests that we correctly highlight ${dollar-brace} style parameter
+ * expansions within interpolated strings.
+ */
+ @Test
+ public void testDollarBrace() {
+ IToken token = getNthToken(2);
+ assertEquals(6, scanner.getTokenLength());
+ assertEquals(1, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_VARIABLE));
+ }
+
+ /**
+ * Tests that we correctly highlight `back-tick` style command substitutions
+ * within interpolated strings.
+ */
+ @Test
+ public void testEval() {
+ IToken token = getNthToken(5);
+ assertEquals(6, scanner.getTokenLength());
+ assertEquals(12, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_EVAL));
+ }
+
+ /**
+ * Tests that we correctly highlight $(dollar-brace) style command
+ * substitutions within interpolated strings.
+ */
+ @Test
+ public void testDollarEval() {
+ IToken token = getNthToken(7);
+ assertEquals(7, scanner.getTokenLength());
+ assertEquals(19, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_EVAL));
+ }
+
+ /**
+ * Everything else should have the default highlighting for this partition
+ * type.
+ */
+ @Test
+ public void testDefault() {
+ IToken token = getNthToken(1);
+ assertEquals(1, scanner.getTokenLength());
+ assertEquals(0, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_DOUBLE_QUOTE));
+
+ token = getNthToken(2);
+ assertEquals(1, scanner.getTokenLength());
+ assertEquals(7, scanner.getTokenOffset());
+ ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_DOUBLE_QUOTE));
+
+ token = getNthToken(3);
+ assertEquals(1, scanner.getTokenLength());
+ assertEquals(18, scanner.getTokenOffset());
+ ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_DOUBLE_QUOTE));
+ }
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/EvalScannerTest.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/EvalScannerTest.java
new file mode 100644
index 0000000..f7ba2e4
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/EvalScannerTest.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mat Booth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.dltk.sh.ui.Activator;
+import org.eclipse.dltk.sh.ui.IShellColorConstants;
+import org.eclipse.dltk.sh.ui.text.EvalScanner;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.junit.Test;
+
+/**
+ * Test the scanner for command substitution partitions.
+ */
+public class EvalScannerTest extends AbstractScannerTester {
+
+ @Override
+ protected RuleBasedScanner getScanner() {
+ return new EvalScanner(cm, Activator.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected String getText() {
+ return "$vars in command ${substitutions}";
+ }
+
+ /**
+ * Tests that we correctly highlight $dollar style parameter expansions
+ * within command substitutions.
+ */
+ @Test
+ public void testDollar() {
+ IToken token = getNextToken();
+ assertEquals(5, scanner.getTokenLength());
+ assertEquals(0, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_VARIABLE));
+ }
+
+ /**
+ * Tests that we correctly highlight ${dollar-brace} style parameter
+ * expansions within command substitutions.
+ */
+ @Test
+ public void testDollarBrace() {
+ IToken token = getNthToken(14);
+ assertEquals(16, scanner.getTokenLength());
+ assertEquals(17, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_VARIABLE));
+ }
+
+ /**
+ * Everything else should have the default highlighting for this partition
+ * type.
+ */
+ @Test
+ public void testDefault() {
+ IToken token = getNthToken(3);
+ assertEquals(1, scanner.getTokenLength());
+ assertEquals(6, scanner.getTokenOffset());
+ TextAttribute ta = (TextAttribute) token.getData();
+ assertEquals(ta.getForeground(), cm.getColor(IShellColorConstants.SHELL_EVAL));
+ }
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/MockScanner.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/MockScanner.java
new file mode 100644
index 0000000..e9d0d03
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/MockScanner.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Mat Booth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import org.eclipse.jface.text.rules.ICharacterScanner;
+
+/**
+ * Simple concrete character scanner that we can use to test IPredicateRule and
+ * IRule implementations. As far as the rule being tested is concerned, this
+ * scanner is feeding it chunks of a real document.
+ */
+public class MockScanner implements ICharacterScanner {
+
+ private int fOffset = 0;
+ private String fBuffer;
+
+ /**
+ * Dummy scanner on given buffer.
+ *
+ * @param buffer
+ * The buffer.
+ */
+ public MockScanner(String buffer) {
+ fBuffer = buffer;
+ }
+
+ /**
+ * @return The offset.
+ */
+ public int getOffset() {
+ return fOffset;
+ }
+
+ /**
+ * @return The buffer.
+ */
+ public String getBuffer() {
+ return fBuffer;
+ }
+
+ @Override
+ public int getColumn() {
+ return 0;
+ }
+
+ @Override
+ public char[][] getLegalLineDelimiters() {
+ return new char[][] { { '\r' }, { '\n' }, { '\r', '\n' }, };
+ }
+
+ @Override
+ public int read() {
+
+ if (fOffset < fBuffer.length()) {
+ return fBuffer.charAt(fOffset++);
+ }
+ return EOF;
+ }
+
+ @Override
+ public void unread() {
+ --fOffset;
+ }
+}
diff --git a/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/TextSuite.java b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/TextSuite.java
new file mode 100644
index 0000000..8a80805
--- /dev/null
+++ b/tests/org.eclipse.dltk.sh.ui.tests/src/org/eclipse/dltk/sh/ui/text/tests/TextSuite.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2011 Red Hat Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexander Kurtakov - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.dltk.sh.ui.text.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for all org.eclipse.dltk.sh.ui.text tests.
+ *
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ AssignmentRuleTest.class, DollarBraceCountingRuleTest.class, DollarRuleTest.class,
+ DoubleQuoteScannerTest.class, EvalScannerTest.class })
+public class TextSuite {
+}

Back to the top