use of org.eclipse.emf.ecore.resource.Resource in project xtext-xtend by eclipse.
the class TypeUsageCollectorTest method hasUnresolvedTypesWithErrors.
private void hasUnresolvedTypesWithErrors(final CharSequence xtendFile, final String... typeNames) {
try {
final Resource resource = this.fileWithErrors(xtendFile.toString()).eResource();
this.hasUnresolvedType(resource, typeNames);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.emf.ecore.resource.Resource in project xtext-xtend by eclipse.
the class JavaDocTypeReferenceProviderTest method testComputation_5.
@Test
public void testComputation_5() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("class Foo{");
_builder.newLine();
_builder.append("\t");
_builder.append("/**");
_builder.newLine();
_builder.append("\t");
_builder.append("* @param string - a fancy string");
_builder.newLine();
_builder.append("\t");
_builder.append("* @param anotherString-even more fancy");
_builder.newLine();
_builder.append("\t");
_builder.append("* @param zonk");
_builder.newLine();
_builder.append("\t");
_builder.append("*/");
_builder.newLine();
_builder.append("\t");
_builder.append("def bar(String string, String anotherString, Integer zonk){}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final String input = _builder.toString();
Resource _eResource = this.clazz(input).eResource();
final XtextResource resource = ((XtextResource) _eResource);
final ICompositeNode rootNode = resource.getParseResult().getRootNode();
final List<ReplaceRegion> regions = this.javaDocTypeReferenceProvider.computeParameterTypeRefRegions(rootNode);
Assert.assertEquals(3, regions.size());
Assert.assertEquals("string", IterableExtensions.<ReplaceRegion>head(regions).getText());
Assert.assertEquals(input.indexOf("string"), IterableExtensions.<ReplaceRegion>head(regions).getOffset());
Assert.assertEquals("string".length(), IterableExtensions.<ReplaceRegion>head(regions).getLength());
Assert.assertEquals("anotherString", regions.get(1).getText());
Assert.assertEquals(input.indexOf("anotherString"), regions.get(1).getOffset());
Assert.assertEquals("anotherString".length(), regions.get(1).getLength());
Assert.assertEquals("zonk", regions.get(2).getText());
Assert.assertEquals(input.indexOf("zonk"), regions.get(2).getOffset());
Assert.assertEquals("zonk".length(), regions.get(2).getLength());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.emf.ecore.resource.Resource in project xtext-xtend by eclipse.
the class JavaDocTypeReferenceProviderTest method testComputation_3.
@Test
public void testComputation_3() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("/**");
_builder.newLine();
_builder.append("* {@link java.util.ArrayList");
_builder.newLine();
_builder.append("*/");
_builder.newLine();
_builder.append("class Foo{}");
_builder.newLine();
final String input = _builder.toString();
Resource _eResource = this.clazz(input).eResource();
final XtextResource resource = ((XtextResource) _eResource);
final ICompositeNode rootNode = resource.getParseResult().getRootNode();
final List<ReplaceRegion> regions = this.javaDocTypeReferenceProvider.computeTypeRefRegions(rootNode);
Assert.assertEquals(0, regions.size());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.emf.ecore.resource.Resource in project xtext-xtend by eclipse.
the class JavaDocTypeReferenceProviderTest method testComputation_8.
@Test
public void testComputation_8() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("/**");
_builder.newLine();
_builder.append("* @see String");
_builder.newLine();
_builder.append("*/");
_builder.newLine();
_builder.append("class Foo{}");
_builder.newLine();
final String input = _builder.toString();
Resource _eResource = this.clazz(input).eResource();
final XtextResource resource = ((XtextResource) _eResource);
final ICompositeNode rootNode = resource.getParseResult().getRootNode();
final List<ReplaceRegion> regions = this.javaDocTypeReferenceProvider.computeTypeRefRegions(rootNode);
Assert.assertEquals(1, regions.size());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.emf.ecore.resource.Resource in project xtext-xtend by eclipse.
the class JavaDocTypeReferenceProviderTest method testComputation_7.
@Test
public void testComputation_7() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.newLine();
_builder.append("/**");
_builder.newLine();
_builder.append("* {@link String}");
_builder.newLine();
_builder.append("*/");
_builder.newLine();
_builder.append("class Foo{}");
_builder.newLine();
final String input = _builder.toString();
Resource _eResource = this.clazz(input).eResource();
final XtextResource resource = ((XtextResource) _eResource);
final ICompositeNode rootNode = resource.getParseResult().getRootNode();
final List<ReplaceRegion> regions = this.javaDocTypeReferenceProvider.computeTypeRefRegions(rootNode);
Assert.assertEquals(1, regions.size());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations