use of org.eclipse.n4js.jsdoc2spec.adoc.SpecIdentifiableElementSection in project n4js by eclipse.
the class SpecADocXpectMethod method specADoc.
/**
* Checks that an element/expression produces a certain specification string. Usage:
*
* <pre>
* /* X-PECT specADoc at 'location' ---
* expected spec output
* --- * /
* </pre>
*
* The location (at) is optional.
*
* Note that the X-PECT comment must be written <b>before</b> the JSDoc comment of the element.
*
* @param arg1
* the location identified by the offset.
*/
@Xpect
@ParameterParser(syntax = "('at' arg1=STRING)?")
public void specADoc(@StringExpectation(caseSensitive = true) IStringExpectation expectation, IEObjectCoveringRegion arg1) {
if (expectation == null) {
throw new IllegalStateException("No expectation specified, add '--- expected expectation ---");
}
IdentifiableElement element = getIdentifiableElement(arg1);
SpecIdentifiableElementSection src = new SpecIdentifiableElementSection(element, repoPathHolder);
String actual = formatter.createSpecRegionString(src, Collections.emptyMap()).toString();
expectation.assertEquals(actual);
}
Aggregations