aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2008-12-20 08:21:59 (EST)
committersefftinge2008-12-20 08:21:59 (EST)
commit2329526861387056ac65c24e322de51efaf51135 (patch)
tree101f1604f2bbc491e7ce12ff7fc63c45be2f6da0
parentf3a986580b9f6868c9bc6e86c2189ef383757821 (diff)
downloadorg.eclipse.xtext-2329526861387056ac65c24e322de51efaf51135.zip
org.eclipse.xtext-2329526861387056ac65c24e322de51efaf51135.tar.gz
org.eclipse.xtext-2329526861387056ac65c24e322de51efaf51135.tar.bz2
Fix: Try harder to derive a metamodel so content assist does a better job in the xtext grammar editor
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/Xtext2EcoreTransformerTest.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/Xtext2EcoreTransformerTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/Xtext2EcoreTransformerTest.java
index 79e541a..fc47fb2 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/Xtext2EcoreTransformerTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/Xtext2EcoreTransformerTest.java
@@ -564,9 +564,9 @@ public class Xtext2EcoreTransformerTest extends AbstractGeneratorTest {
grammar += " RuleA: featureA=ID;"; // no alias => cannot be created
grammar += " RuleB returns target::TypeB: featureB=ID;";
-// errorAcceptorMock.acceptError(same(TransformationErrorCode.AliasForMetamodelAlreadyExists), (String) anyObject(), (EObject) anyObject());
-// errorAcceptorMock.acceptError(same(TransformationErrorCode.UnknownMetaModelAlias), (String) anyObject(), (EObject) anyObject());
-// errorAcceptorMock.acceptError(same(TransformationErrorCode.UnknownMetaModelAlias), (String) anyObject(), (EObject) anyObject());
+ errorAcceptorMock.acceptError(same(TransformationErrorCode.AliasForMetamodelAlreadyExists), (String) anyObject(), (EObject) anyObject());
+ errorAcceptorMock.acceptError(same(TransformationErrorCode.UnknownMetaModelAlias), (String) anyObject(), (EObject) anyObject());
+ errorAcceptorMock.acceptError(same(TransformationErrorCode.UnknownMetaModelAlias), (String) anyObject(), (EObject) anyObject());
List<EPackage> ePackages = getEPackagesFromGrammar(grammar);
assertEquals(0, ePackages.size());
@@ -574,9 +574,9 @@ public class Xtext2EcoreTransformerTest extends AbstractGeneratorTest {
public void testModifyingSealedModel() throws Exception {
final String grammar = "language test generate test 'http://test' import 'http://www.eclipse.org/emf/2002/Ecore' as ecore RuleA returns ecore::SomeNewTypeA: feature=ID;";
-// errorAcceptorMock.acceptError(same(TransformationErrorCode.CannotCreateTypeInSealedMetamodel), (String) anyObject(), (EObject) anyObject());
- List<EPackage> result = getEPackagesFromGrammar(grammar);
- assertTrue(result.isEmpty());
+ errorAcceptorMock.acceptError(same(TransformationErrorCode.CannotCreateTypeInSealedMetamodel), (String) anyObject(), (EObject) anyObject());
+ EPackage result = getEPackageFromGrammar(grammar);
+ assertTrue(result.getEClassifiers().isEmpty());
}
public void testImportingUnknownModel() throws Exception {
@@ -704,8 +704,11 @@ public class Xtext2EcoreTransformerTest extends AbstractGeneratorTest {
public void testCallOfUndeclaredRule() throws Exception {
String grammar = "language test generate test 'http://test'";
grammar += " RuleA: CallOfUndeclaredRule featureA=ID;";
- List<EPackage> ePackages = getEPackagesFromGrammar(grammar);
- assertTrue(ePackages.isEmpty());
+ errorAcceptorMock.acceptError(same(TransformationErrorCode.NoSuchRuleAvailable), (String) anyObject(),
+ (EObject) anyObject());
+ EPackage ePackage = getEPackageFromGrammar(grammar);
+ assertEquals(1, ePackage.getEClassifiers().size());
+ assertEquals("RuleA", ePackage.getEClassifiers().get(0).getName());
}
public void testCycleInTypeHierarchy() throws Exception {