use of org.eclipse.xtext.xtext.ecoreInference.EClassifierInfos in project xtext-core by eclipse.
the class Xtext2EcoreTransformerTest method testTypesOfImplicitSuperGrammar.
@Test
public void testTypesOfImplicitSuperGrammar() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("MyRule: myFeature=INT;");
_builder.newLine();
final String xtextGrammar = _builder.toString();
EObject _model = this.getModel(xtextGrammar);
final Grammar grammar = ((Grammar) _model);
final Xtext2EcoreTransformer transformer = new Xtext2EcoreTransformer(grammar);
transformer.removeGeneratedPackages();
transformer.transform();
final AbstractRule rule = IterableExtensions.<AbstractRule>head(grammar.getRules());
TypeRef type = rule.getType();
Assert.assertNotNull(type);
Assert.assertNotNull(transformer.getEClassifierInfos().getInfo(type));
AbstractMetamodelDeclaration _get = GrammarUtil.allMetamodelDeclarations(grammar).get(1);
final ReferencedMetamodel referenced = ((ReferencedMetamodel) _get);
Assert.assertNotNull(referenced);
Assert.assertEquals("ecore", referenced.getAlias());
Assert.assertNull(transformer.getEClassifierInfos().getInfo(referenced, "EString"));
Assert.assertNull(transformer.getEClassifierInfos().getInfo(referenced, "EInt"));
EClassifierInfos parentInfos = IterableExtensions.<EClassifierInfos>head(transformer.getEClassifierInfos().getParents());
Assert.assertNotNull(parentInfos.getInfo(referenced, "EString"));
Assert.assertNotNull(parentInfos.getInfo(referenced, "EInt"));
}
Aggregations