aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormclay2009-04-01 12:32:25 (EDT)
committersefftinge2009-04-01 12:32:25 (EDT)
commit59ade4c4dbaf762048c57362ce831d6738b79772 (patch)
tree0753817157b8e9134c4ef92b6cc2325a65a77880
parent0caa23142f076ca70911127932f1c428aed09b0a (diff)
downloadorg.eclipse.xtext-59ade4c4dbaf762048c57362ce831d6738b79772.zip
org.eclipse.xtext-59ade4c4dbaf762048c57362ce831d6738b79772.tar.gz
org.eclipse.xtext-59ade4c4dbaf762048c57362ce831d6738b79772.tar.bz2
obsolete with fix: bug '#270773 - ClassCastException with EEnums'
..nevertheless i have added three tests in DefaultContentAssistProcessorTest to assert correct CA behaviour for enums,terminal and normal rules
-rw-r--r--tests/org.eclipse.xtext.ui.common.tests/src/org/eclipse/xtext/ui/common/editor/contentassist/impl/DefaultContentAssistProcessorTest.java76
1 files changed, 66 insertions, 10 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/DefaultContentAssistProcessorTest.java
index 6110543..950909d 100644
--- 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/DefaultContentAssistProcessorTest.java
@@ -18,6 +18,9 @@ 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;
@@ -54,7 +57,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
};
}
- private ISetup getXtextGrammarSetup() {
+ private ISetup getXtextGrammarTestSetup() {
return new XtextGrammarTestLanguageStandaloneSetup() {
@Override
public Injector createInjector() {
@@ -62,6 +65,15 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
};
}
+
+ private ISetup getXtextSetup() {
+ return new XtextStandaloneSetup() {
+ @Override
+ public Injector createInjector() {
+ return Guice.createInjector(new XtextRuntimeModule(), new XtextUiModule());
+ }
+ };
+ }
private ISetup getContentAssistGrammarSetup() {
return new ContentAssistTestLanguageStandaloneSetup() {
@@ -196,7 +208,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
public void testCompleteRuleCall() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("R1 : (attr+=R2)*;")
@@ -233,7 +245,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=260825
*/
public void testCompleteParserRule_01() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("MyRule : 'foo' name=ID; ").assertText(
@@ -242,7 +254,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testCompleteParserRule_02() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -256,7 +268,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testCompleteParserRule_03() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -270,7 +282,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void _testCompleteGenerateKeyword() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -280,7 +292,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
}
public void testCompleteImportAndGenerateRule() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("")
@@ -299,7 +311,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=269593
*/
public void testCompleteRuleCallWithSpace() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo")
.appendNl("generate foo \"foo\"")
.appendNl("R1 : (attr+=R2)*;")
@@ -331,7 +343,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=269649
*/
public void testCompletionOnGenerateKeyword() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo with org.eclipse.xtext.common.Terminals")
.appendNl("generate meta \"url\"")
.appendNl("Rule: name=ID;")
@@ -346,7 +358,7 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=267582
*/
public void testCompleteAssignmentWithBacktracking() throws Exception {
- newBuilder(getXtextGrammarSetup())
+ newBuilder(getXtextGrammarTestSetup())
.appendNl("grammar foo with org.eclipse.xtext.common.Terminals")
.appendNl("generate foo \"foo\"")
.append("MyRule : 'foo' name").assertText("\"Keyword_Value\"", "(", "*", "+", "+=", ";", "=", "?", "?=",
@@ -355,6 +367,36 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
.append("terminal Other_Id").assertText(":","returns");
}
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
+ * @throws Exception
+ */
+ public void testCompleteTypeRefReturnForEnumRule() throws Exception {
+ doTestCompleteTypeRefSetup()
+ .appendNl("enum NewEnum returns").assertText(
+ "Class", "Import","Model","NewEnum"
+ );
+ }
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
+ * @throws Exception
+ */
+ public void testCompleteTypeRefReturnForParserRule() throws Exception {
+ doTestCompleteTypeRefSetup()
+ .appendNl("NewType returns").assertText(
+ "Class", "Import","Model","NewType"
+ );
+ }
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=270116
+ * @throws Exception
+ */
+ public void testCompleteTypeRefReturnForTerminalRule() throws Exception {
+ doTestCompleteTypeRefSetup()
+ .appendNl("terminal NewType returns").assertText(
+ "Class", "Import","Model"
+ );
+ }
public void testKeywordWithBackslashes() throws Exception {
newBuilder(getKeywordsLangSetup()).assertText("foo\\bar", "foo\\", "\\bar", "\\");
@@ -401,4 +443,18 @@ public class DefaultContentAssistProcessorTest extends AbstractXtextTests {
return new ContentAssistProcessorTestBuilder(standAloneSetup, this);
}
+ private ContentAssistProcessorTestBuilder doTestCompleteTypeRefSetup() throws Exception {
+ return newBuilder(getXtextSetup())
+ .appendNl("grammar org.xtext.example.MyDsl1 with org.eclipse.xtext.common.Terminals")
+ .appendNl("import \"http://www.eclipse.org/emf/2003/Change\"")
+ .appendNl("generate myDsl1 \"http://www.xtext.org/example/MyDsl1\"")
+ .appendNl("Model :")
+ .appendNl("(imports+=Import)*")
+ .appendNl("(elements+=Class)*;")
+ .appendNl("Import :")
+ .appendNl("'import' importURI=STRING;")
+ .appendNl("Class :")
+ .appendNl("'class' name=ID ('extends' references=[Class])?;");
+}
+
} \ No newline at end of file