use of org.eclipse.xtext.linking.importedURI.Type in project xtext-core by eclipse.
the class Bug437669Test method testResolved.
@Test
public void testResolved() {
Type type = resolve("Foo");
Resource resource = type.eResource();
assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
Type resolvedType = type.getExtends();
assertNotNull(resolvedType);
assertFalse(resolvedType.eIsProxy());
assertEquals("Foo", resolvedType.getName());
}
use of org.eclipse.xtext.linking.importedURI.Type in project xtext-core by eclipse.
the class UriBasedReaderTest method testTransitiveReferences.
@SuppressWarnings("unchecked")
@Test
public void testTransitiveReferences() throws Exception {
UriBasedReader reader = new UriBasedReader();
reader.addRegister(new ImportUriTestLanguageStandaloneSetup());
reader.addUri(pathTo2("importUriSubfolder/Start.importuritestlanguage"));
SlotEntry slotEntry = new SlotEntry();
slotEntry.setType("Type");
reader.addLoad(slotEntry);
WorkflowContext ctx = new WorkflowContextDefaultImpl();
IssuesImpl issues = new IssuesImpl();
reader.checkConfiguration(issues);
try {
reader.invoke(ctx, new NullProgressMonitor(), issues);
} catch (Exception e) {
System.out.println(issues);
throw e;
}
List<Type> types = (List<Type>) ctx.get(slotEntry.getSlot());
assertEquals(3, types.size());
for (Type type : types) {
if (type.getName().equals("Foo")) {
assertEquals("Bar", type.getExtends().getName());
} else if (type.getName().equals("Bar")) {
assertEquals("Baz", type.getExtends().getName());
} else {
assertNull(type.getExtends());
}
}
}
Aggregations