aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-04-15 09:07:05 (EDT)
committersefftinge2009-04-15 09:07:05 (EDT)
commit4d7f07c53a1d8823879400803facd787f15365c6 (patch)
treed2c1c733570be4935b4cb2940bbab195b2ca2840
parentb714f5953c6b6cf1312763e492fe77d853839416 (diff)
downloadorg.eclipse.xtext-4d7f07c53a1d8823879400803facd787f15365c6.zip
org.eclipse.xtext-4d7f07c53a1d8823879400803facd787f15365c6.tar.gz
org.eclipse.xtext-4d7f07c53a1d8823879400803facd787f15365c6.tar.bz2
Fix: Scope was not calculated properly for enum literals (assumptions about type of 'context' parameter were wrong ;-)
-rwxr-xr-x[-rw-r--r--]tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/AbstractContentAssistProcessorTest.java (renamed from tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java)157
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/IContentAssistProcessorTestSetup.java29
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTest.java20
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTestSetup.java92
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/tests/AllTests.java4
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/DefaultXtendContentAssistProcessorTest.java31
-rwxr-xr-xtests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTest.java35
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTestSetup.java94
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/tests/PluginTestSuite.java2
9 files changed, 327 insertions, 137 deletions
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/AbstractContentAssistProcessorTest.java
index b573bb3..3a22dc6 100644..100755
--- a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/AbstractContentAssistProcessorTest.java
@@ -13,31 +13,8 @@
*******************************************************************************/
package org.eclipse.xtext.ui.common.editor.contentassist.impl;
-
import org.eclipse.xtext.ISetup;
-import org.eclipse.xtext.XtextGrammarTestLanguageRuntimeModule;
-import org.eclipse.xtext.XtextGrammarTestLanguageStandaloneSetup;
-import org.eclipse.xtext.XtextGrammarTestLanguageUiModule;
-import org.eclipse.xtext.XtextRuntimeModule;
-import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.XtextUiModule;
-import org.eclipse.xtext.enumrules.EnumRulesTestLanguageRuntimeModule;
-import org.eclipse.xtext.enumrules.EnumRulesTestLanguageStandaloneSetup;
-import org.eclipse.xtext.enumrules.EnumRulesTestLanguageUiModule;
import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageRuntimeModule;
-import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageStandaloneSetup;
-import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageUiModule;
-import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageRuntimeModule;
-import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageStandaloneSetup;
-import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageUiModule;
-import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageRuntimeModule;
-import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
-import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageUiModule;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
/**
* Unit test for class <code>DefaultContentAssistProcessor</code>. Reused by Xtend implementation.
@@ -46,65 +23,27 @@ import com.google.inject.Injector;
* @author Jan Koehnlein
* @see org.eclipse.xtext.ui.common.editor.contentassist.impl.DefaultContentAssistProcessor
*/
-public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
+public abstract class AbstractContentAssistProcessorTest extends AbstractXtextTests {
- private ISetup getRefGrammarSetup() {
- return new ReferenceGrammarTestLanguageStandaloneSetup() {
- @Override
- public Injector createInjector() {
- return Guice.createInjector(new ReferenceGrammarTestLanguageRuntimeModule(), new ReferenceGrammarTestLanguageUiModule());
- }
- };
- }
-
- private ISetup getXtextGrammarTestSetup() {
- return new XtextGrammarTestLanguageStandaloneSetup() {
- @Override
- public Injector createInjector() {
- return Guice.createInjector(new XtextGrammarTestLanguageRuntimeModule(), new XtextGrammarTestLanguageUiModule());
- }
- };
- }
+ private IContentAssistProcessorTestSetup setup;
- private ISetup getXtextSetup() {
- return new XtextStandaloneSetup() {
- @Override
- public Injector createInjector() {
- return Guice.createInjector(new XtextRuntimeModule(), new XtextUiModule());
- }
- };
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setup = createSetup();
}
- private ISetup getContentAssistGrammarSetup() {
- return new ContentAssistTestLanguageStandaloneSetup() {
- @Override
- public Injector createInjector() {
- return Guice.createInjector(new ContentAssistTestLanguageRuntimeModule(), new ContentAssistTestLanguageUiModule());
- }
- };
- }
-
- private ISetup getKeywordsLangSetup() {
- return new KeywordsTestLanguageStandaloneSetup() {
- @Override
- public Injector createInjector() {
- return Guice.createInjector(new KeywordsTestLanguageRuntimeModule(), new KeywordsTestLanguageUiModule());
- }
- };
- }
+ protected abstract IContentAssistProcessorTestSetup createSetup();
- private ISetup getEnumsLangSetup() {
- return new EnumRulesTestLanguageStandaloneSetup() {
- @Override
- public Injector createInjector() {
- return Guice.createInjector(new EnumRulesTestLanguageRuntimeModule(), new EnumRulesTestLanguageUiModule());
- }
- };
+ @Override
+ protected void tearDown() throws Exception {
+ setup = null;
+ super.tearDown();
}
-
+
public void testComputePrefix() throws Exception {
String model = "spielplatz 1 \"SpielplatzBeschreibung\" { kind(k1 0) kind(k2 0) erwachsener(e1 0) erwachsener(e2 0) ";
- newBuilder(getRefGrammarSetup())
+ newBuilder(setup.getRefGrammarSetup())
.append(model+" familie( dfv(").assertMatchString("(").reset()
.append(model+" familie( dfv").assertMatchString("dfv").reset()
.append(model+" familie( dfv_").assertMatchString("dfv_").reset()
@@ -113,7 +52,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testComputeCompletionProposalsCount() throws Exception {
- newBuilder(getRefGrammarSetup()).assertCount(1)
+ newBuilder(setup.getRefGrammarSetup()).assertCount(1)
.append("spielplatz ").assertCount(1)
.append("1 ").assertCount(2)
.append("\"JUNIT\" ").assertCount(1)
@@ -125,7 +64,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testComputeCompletionProposalsText() throws Exception {
- newBuilder(getRefGrammarSetup()).assertText("spielplatz")
+ newBuilder(setup.getRefGrammarSetup()).assertText("spielplatz")
.applyText().assertText("1")
.applyText().assertText("\"Spielplatz_Beschreibung\"","{")
.applyText().assertText("{")
@@ -152,13 +91,13 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testBetweenContext() throws Exception {
- newBuilder(getRefGrammarSetup())
+ newBuilder(setup.getRefGrammarSetup())
.append("spielplatz 1 \"1\" {kind")
.assertTextAtCursorPosition(18,"kind","erwachsener","spielzeug","familie","}");
}
public void testComputeCompletionProposalsIgnoreCase() throws Exception {
- ContentAssistProcessorTestBuilder builder = newBuilder(getRefGrammarSetup());
+ ContentAssistProcessorTestBuilder builder = newBuilder(setup.getRefGrammarSetup());
builder = builder.append("spielplatz 1 \"SpielplatzBeschreibung\" { kind(k1 0) kind(k2 0) erwachsener(e1 0) erwachsener(e2 0) ");
builder.append(" KI").assertText("kind");
builder.append(" ER").assertText("erwachsener");
@@ -208,7 +147,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
public void testCompleteRuleCall() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("R1 : (attr+=R2)*;")
@@ -224,7 +163,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testCompleteAbstractRuleCall() throws Exception {
- newBuilder(getContentAssistGrammarSetup())
+ newBuilder(setup.getContentAssistGrammarSetup())
.appendNl("abstract rules")
.appendNl("R1 ();")
.append("R2 rule :").assertText(
@@ -234,7 +173,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testDefaultRule() throws Exception {
- ContentAssistProcessorTestBuilder builder = newBuilder(getRefGrammarSetup());
+ ContentAssistProcessorTestBuilder builder = newBuilder(setup.getRefGrammarSetup());
builder.assertText("spielplatz");
builder.append(" spielplatz 1 \"SpielplatzBeschreibung\" { } ")
.assertTextAtCursorPosition(1, "spielplatz");
@@ -245,16 +184,16 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=260825
*/
public void testCompleteParserRule_01() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("MyRule : 'foo' name=ID; ").assertText(
- "ParserRule_Name", "terminal"
+ "ParserRule_Name", "terminal", "enum"
);
}
public void testCompleteParserRule_02() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -262,13 +201,14 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
.assertTextAtCursorPosition("MyRule",
"ParserRule_Name",
"terminal",
+ "enum",
"as",
"generate",
"import");
}
public void testCompleteParserRule_03() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -276,13 +216,14 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
.assertTextAtCursorPosition(" MyRule",
"ParserRule_Name",
"terminal",
+ "enum",
"as",
"generate",
"import");
}
public void _testCompleteGenerateKeyword() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -292,7 +233,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testCompleteImportAndGenerateRule() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -303,7 +244,8 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
"as",
"generate",
"import",
- "terminal"
+ "terminal",
+ "enum"
);
}
@@ -311,7 +253,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=269593
*/
public void testCompleteRuleCallWithSpace() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("R1 : (attr+=R2)*;")
@@ -330,7 +272,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=269593
*/
public void testCompleteAbstractRuleCallWithSpace() throws Exception {
- newBuilder(getContentAssistGrammarSetup())
+ newBuilder(setup.getContentAssistGrammarSetup())
.appendNl("abstract rules")
.appendNl("R1 ();")
.append("R2 rule : ").assertText(
@@ -343,7 +285,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=269649
*/
public void testCompletionOnGenerateKeyword() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo with org.eclipse.xtext.common.Terminals")
.appendNl("generate meta \"url\"")
.appendNl("Rule: name=ID;")
@@ -358,7 +300,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=267582
*/
public void testCompleteAssignmentWithBacktracking() throws Exception {
- newBuilder(getXtextGrammarTestSetup())
+ newBuilder(setup.getXtextGrammarTestSetup())
.appendNl("grammar foo with org.eclipse.xtext.common.Terminals")
.appendNl("generate foo \"foo\"")
.append("MyRule : 'foo' name").assertText("\"Keyword_Value\"", "(", "*", "+", "+=", ";", "=", "?", "?=",
@@ -399,43 +341,52 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testKeywordWithBackslashes() throws Exception {
- newBuilder(getKeywordsLangSetup()).assertText("foo\\bar", "foo\\", "\\bar", "\\");
+ newBuilder(setup.getKeywordsLangSetup()).assertText("foo\\bar", "foo\\", "\\bar", "\\");
}
public void testEnumCompletion_01() throws Exception {
- newBuilder(getEnumsLangSetup()).assertText("existing", "generated");
+ newBuilder(setup.getEnumsLangSetup()).assertText("existing", "generated");
}
public void testEnumCompletion_02() throws Exception {
- newBuilder(getEnumsLangSetup()).append("exi").assertText("existing");
+ newBuilder(setup.getEnumsLangSetup()).append("exi").assertText("existing");
}
public void testEnumCompletion_03() throws Exception {
- newBuilder(getEnumsLangSetup()).append(" ").assertText("existing", "generated");
+ newBuilder(setup.getEnumsLangSetup()).append(" ").assertText("existing", "generated");
}
public void testEnumCompletion_04() throws Exception {
- newBuilder(getEnumsLangSetup()).append("existing").assertText("SameName", "DifferentLiteral", "overridden");
+ newBuilder(setup.getEnumsLangSetup()).append("existing").assertText("SameName", "DifferentLiteral", "overridden");
}
public void testEnumCompletion_05() throws Exception {
- newBuilder(getEnumsLangSetup()).append("existing ").assertText("SameName", "DifferentLiteral", "overridden");
+ newBuilder(setup.getEnumsLangSetup()).append("existing ").assertText("SameName", "DifferentLiteral", "overridden");
}
public void testEnumCompletion_06() throws Exception {
- newBuilder(getEnumsLangSetup()).append("existing Same").assertText("SameName");
+ newBuilder(setup.getEnumsLangSetup()).append("existing Same").assertText("SameName");
}
public void testEnumCompletion_07() throws Exception {
- newBuilder(getEnumsLangSetup()).append("generated SameName").assertTextAtCursorPosition(0, "existing", "generated");
+ newBuilder(setup.getEnumsLangSetup()).append("generated SameName").assertTextAtCursorPosition(0, "existing", "generated");
}
public void testEnumCompletion_08() throws Exception {
- newBuilder(getEnumsLangSetup()).append(" generated SameName").assertTextAtCursorPosition(0, "existing", "generated");
+ newBuilder(setup.getEnumsLangSetup()).append(" generated SameName").assertTextAtCursorPosition(0, "existing", "generated");
}
public void testEnumCompletion_09() throws Exception {
- newBuilder(getEnumsLangSetup()).append(" generated SameName").assertTextAtCursorPosition(2, "generated");
+ newBuilder(setup.getEnumsLangSetup()).append(" generated SameName").assertTextAtCursorPosition(2, "generated");
+ }
+
+ public void testEnumCompletion_10() throws Exception {
+ newBuilder(setup.getXtextSetup())
+ .appendNl("grammar org.xtext.example.MyDsl1 with org.eclipse.xtext.common.Terminals")
+ .appendNl("generate myDsl1 \"http://www.xtext.org/example/MyDsl1\"")
+ .appendNl("import 'classpath:/org/eclipse/xtext/enumrules/enums.ecore'")
+ .appendNl("enum ExistingEnum:")
+ .assertText("SameName", "DifferentName", "OverriddenLiteral");
}
protected ContentAssistProcessorTestBuilder newBuilder(ISetup standAloneSetup) throws Exception {
@@ -444,7 +395,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
private ContentAssistProcessorTestBuilder doTestCompleteTypeRefSetup() throws Exception {
- return newBuilder(getXtextSetup())
+ return newBuilder(setup.getXtextSetup())
.appendNl("grammar org.xtext.example.MyDsl1 with org.eclipse.xtext.common.Terminals")
.appendNl("generate myDsl1 \"http://www.xtext.org/example/MyDsl1\"")
.appendNl("Model :")
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/IContentAssistProcessorTestSetup.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/IContentAssistProcessorTestSetup.java
new file mode 100644
index 0000000..874c646
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/IContentAssistProcessorTestSetup.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 itemis AG (http://www.itemis.eu) 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.xtext.ui.common.editor.contentassist.impl;
+
+import org.eclipse.xtext.ISetup;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public interface IContentAssistProcessorTestSetup {
+
+ ISetup getRefGrammarSetup();
+
+ ISetup getXtextGrammarTestSetup();
+
+ ISetup getXtextSetup();
+
+ ISetup getContentAssistGrammarSetup();
+
+ ISetup getKeywordsLangSetup();
+
+ ISetup getEnumsLangSetup();
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTest.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTest.java
new file mode 100644
index 0000000..3bb9c2c
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTest.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 itemis AG (http://www.itemis.eu) 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.xtext.ui.common.editor.contentassist.impl;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public class JavaContentAssistProcessorTest extends AbstractContentAssistProcessorTest {
+
+ @Override
+ protected JavaContentAssistProcessorTestSetup createSetup() {
+ return new JavaContentAssistProcessorTestSetup();
+ }
+
+}
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTestSetup.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTestSetup.java
new file mode 100644
index 0000000..1b0f192
--- /dev/null
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/JavaContentAssistProcessorTestSetup.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009 itemis AG (http://www.itemis.eu) 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.xtext.ui.common.editor.contentassist.impl;
+
+import org.eclipse.xtext.ISetup;
+import org.eclipse.xtext.XtextGrammarTestLanguageRuntimeModule;
+import org.eclipse.xtext.XtextGrammarTestLanguageStandaloneSetup;
+import org.eclipse.xtext.XtextGrammarTestLanguageUiModule;
+import org.eclipse.xtext.XtextRuntimeModule;
+import org.eclipse.xtext.XtextStandaloneSetup;
+import org.eclipse.xtext.XtextUiModule;
+import org.eclipse.xtext.enumrules.EnumRulesTestLanguageRuntimeModule;
+import org.eclipse.xtext.enumrules.EnumRulesTestLanguageStandaloneSetup;
+import org.eclipse.xtext.enumrules.EnumRulesTestLanguageUiModule;
+import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageRuntimeModule;
+import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageStandaloneSetup;
+import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageUiModule;
+import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageRuntimeModule;
+import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageStandaloneSetup;
+import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageUiModule;
+import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageRuntimeModule;
+import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
+import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageUiModule;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public class JavaContentAssistProcessorTestSetup implements IContentAssistProcessorTestSetup {
+
+ public ISetup getRefGrammarSetup() {
+ return new ReferenceGrammarTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new ReferenceGrammarTestLanguageRuntimeModule(), new ReferenceGrammarTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getXtextGrammarTestSetup() {
+ return new XtextGrammarTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new XtextGrammarTestLanguageRuntimeModule(), new XtextGrammarTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getXtextSetup() {
+ return new XtextStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new XtextRuntimeModule(), new XtextUiModule());
+ }
+ };
+ }
+
+ public ISetup getContentAssistGrammarSetup() {
+ return new ContentAssistTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new ContentAssistTestLanguageRuntimeModule(), new ContentAssistTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getKeywordsLangSetup() {
+ return new KeywordsTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new KeywordsTestLanguageRuntimeModule(), new KeywordsTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getEnumsLangSetup() {
+ return new EnumRulesTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new EnumRulesTestLanguageRuntimeModule(), new EnumRulesTestLanguageUiModule());
+ }
+ };
+ }
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/tests/AllTests.java b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/tests/AllTests.java
index dc1930654..8d35868 100644
--- a/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/tests/AllTests.java
+++ b/tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/tests/AllTests.java
@@ -11,8 +11,8 @@ package org.eclipse.xtext.ui.common.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.xtext.ui.common.editor.contentassist.impl.DefaultContentAssistProcessorTest;
import org.eclipse.xtext.ui.common.editor.contentassist.impl.DynamicDispatchTest;
+import org.eclipse.xtext.ui.common.editor.contentassist.impl.JavaContentAssistProcessorTest;
import org.eclipse.xtext.ui.common.editor.hyperlinking.HyperlinkHelperTest;
import org.eclipse.xtext.ui.common.editor.outline.impl.DefaultSemanticModelTransformerTest;
@@ -25,7 +25,7 @@ public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.eclipse.xtext.ui.common.tests");
// $JUnit-BEGIN$
- suite.addTestSuite(DefaultContentAssistProcessorTest.class);
+ suite.addTestSuite(JavaContentAssistProcessorTest.class);
suite.addTestSuite(DefaultSemanticModelTransformerTest.class);
suite.addTestSuite(HyperlinkHelperTest.class);
suite.addTestSuite(DynamicDispatchTest.class);
diff --git a/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/DefaultXtendContentAssistProcessorTest.java b/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/DefaultXtendContentAssistProcessorTest.java
deleted file mode 100644
index 97315f3..0000000
--- a/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/DefaultXtendContentAssistProcessorTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-///*******************************************************************************
-// * Copyright (c) 2008 itemis AG (http://www.itemis.eu) 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.xtext.xtend.contentassist;
-//
-//import org.eclipse.xtext.ISetup;
-//import org.eclipse.xtext.ui.common.editor.contentassist.IProposalProvider;
-//import org.eclipse.xtext.ui.common.editor.contentassist.impl.ContentAssistProcessorTestBuilder;
-//import org.eclipse.xtext.ui.common.editor.contentassist.impl.DefaultContentAssistProcessorTest;
-//
-///**
-// * @author Jan Köhnlein - Initial contribution and API
-// */
-//public class DefaultXtendContentAssistProcessorTest extends DefaultContentAssistProcessorTest {
-//
-// /* (non-Javadoc)
-// * @see org.eclipse.xtext.ui.common.editor.contentassist.impl.DefaultContentAssistProcessorTest#newBuilder(java.lang.String)
-// */
-// @Override
-// protected ContentAssistProcessorTestBuilder newBuilder(ISetup setup) throws Exception {
-// ContentAssistProcessorTestBuilder newBuilder = super.newBuilder(setup);
-// assertTrue(newBuilder.get(IProposalProvider.class) instanceof AbstractXtendProposalProvider);
-// return newBuilder;
-// }
-//
-//}
-
diff --git a/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTest.java b/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTest.java
new file mode 100755
index 0000000..81a761b
--- /dev/null
+++ b/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTest.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 itemis AG (http://www.itemis.eu) 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.xtext.xtend.contentassist;
+
+import org.eclipse.xtext.ISetup;
+import org.eclipse.xtext.ui.common.editor.contentassist.IProposalProvider;
+import org.eclipse.xtext.ui.common.editor.contentassist.impl.ContentAssistProcessorTestBuilder;
+import org.eclipse.xtext.ui.common.editor.contentassist.impl.AbstractContentAssistProcessorTest;
+import org.eclipse.xtext.ui.common.editor.contentassist.impl.IContentAssistProcessorTestSetup;
+
+/**
+ * @author Jan Köhnlein - Initial contribution and API
+ */
+public abstract class XtendContentAssistProcessorTest extends AbstractContentAssistProcessorTest {
+
+ @Override
+ protected ContentAssistProcessorTestBuilder newBuilder(ISetup setup) throws Exception {
+ ContentAssistProcessorTestBuilder newBuilder = super.newBuilder(setup);
+ IProposalProvider proposalProvider = newBuilder.get(IProposalProvider.class);
+ assertTrue(proposalProvider.toString(), proposalProvider instanceof AbstractXtendProposalProvider);
+ return newBuilder;
+ }
+
+ @Override
+ protected IContentAssistProcessorTestSetup createSetup() {
+ return new XtendContentAssistProcessorTestSetup();
+ }
+
+}
+
diff --git a/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTestSetup.java b/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTestSetup.java
new file mode 100644
index 0000000..e06cd68
--- /dev/null
+++ b/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/contentassist/XtendContentAssistProcessorTestSetup.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 itemis AG (http://www.itemis.eu) 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.xtext.xtend.contentassist;
+
+import org.eclipse.xtext.ISetup;
+import org.eclipse.xtext.XtextGrammarTestLanguageRuntimeModule;
+import org.eclipse.xtext.XtextGrammarTestLanguageStandaloneSetup;
+import org.eclipse.xtext.XtextGrammarTestLanguageUiModule;
+import org.eclipse.xtext.XtextRuntimeModule;
+import org.eclipse.xtext.XtextStandaloneSetup;
+import org.eclipse.xtext.XtextUiModule;
+import org.eclipse.xtext.enumrules.EnumRulesTestLanguageRuntimeModule;
+import org.eclipse.xtext.enumrules.EnumRulesTestLanguageStandaloneSetup;
+import org.eclipse.xtext.enumrules.EnumRulesTestLanguageUiModule;
+import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageRuntimeModule;
+import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageStandaloneSetup;
+import org.eclipse.xtext.parser.keywords.KeywordsTestLanguageUiModule;
+import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageRuntimeModule;
+import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageStandaloneSetup;
+import org.eclipse.xtext.testlanguages.ContentAssistTestLanguageUiModule;
+import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageRuntimeModule;
+import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
+import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageUiModule;
+import org.eclipse.xtext.ui.common.editor.contentassist.impl.IContentAssistProcessorTestSetup;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public class XtendContentAssistProcessorTestSetup implements IContentAssistProcessorTestSetup {
+
+ public ISetup getRefGrammarSetup() {
+ return new ReferenceGrammarTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new ReferenceGrammarTestLanguageRuntimeModule(), new ReferenceGrammarTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getXtextGrammarTestSetup() {
+ return new XtextGrammarTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new XtextGrammarTestLanguageRuntimeModule(), new XtextGrammarTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getXtextSetup() {
+ return new XtextStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new XtextRuntimeModule(), new XtextUiModule());
+ }
+ };
+ }
+
+ public ISetup getContentAssistGrammarSetup() {
+ return new ContentAssistTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new ContentAssistTestLanguageRuntimeModule(), new ContentAssistTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getKeywordsLangSetup() {
+ return new KeywordsTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new KeywordsTestLanguageRuntimeModule(), new KeywordsTestLanguageUiModule());
+ }
+ };
+ }
+
+ public ISetup getEnumsLangSetup() {
+ return new EnumRulesTestLanguageStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new EnumRulesTestLanguageRuntimeModule(), new EnumRulesTestLanguageUiModule());
+ }
+ };
+ }
+
+
+}
diff --git a/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/tests/PluginTestSuite.java b/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/tests/PluginTestSuite.java
index 048cc9d..faa26fe 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/tests/PluginTestSuite.java
+++ b/tests/org.eclipse.xtext.xtend.tests/src/org/eclipse/xtext/xtend/tests/PluginTestSuite.java
@@ -20,7 +20,7 @@ public class PluginTestSuite {
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.eclipse.xtext.xtend.tests");
//$JUnit-BEGIN$
-// suite.addTestSuite(DefaultXtendContentAssistProcessorTest.class);
+// suite.addTestSuite(XtendContentAssistProcessorTest.class);
suite.addTestSuite(XtendScopeProviderTest.class);
//$JUnit-END$
return suite;