use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.
the class LineTagTest method testLineTagDescr.
@SuppressWarnings("javadoc")
@Test
public void testLineTagDescr() {
String in = "/** foo." + "\n * @stubLineTagTitle tag description. " + "\n */";
AbstractLineTagDefinition tag = new StubLineTagWithRegionDefinition("stubLineTagTitle");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
LineTag lineTag = doclet.getLineTags().get(0);
TagValue vDescription = lineTag.getValueByKey(StubLineTagWithRegionDefinition.DESCR);
Text tabDescription = (Text) vDescription.getContents().get(0);
String deString = tabDescription.getText();
assertEquals("tag description. ", deString);
}
use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.
the class LineTagTest method testSimpleLineTag.
@SuppressWarnings("javadoc")
@Test
public void testSimpleLineTag() {
String in = "/** foo.\n * @stubLineTagTitle \n */";
AbstractLineTagDefinition tag = new StubLineTagWithRegionDefinition("stubLineTagTitle");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
LineTag lineTag = doclet.getLineTags().get(0);
assertEquals("stubLineTagTitle", lineTag.getTitle().getTitle());
}
use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.
the class LineTagTest method testLineTagWithRegionAndDescr.
@SuppressWarnings("javadoc")
@Test
public void testLineTagWithRegionAndDescr() {
String in = "/** foo.\n * @stubLineTagTitle {@region value} tag description. \n */";
AbstractLineTagDefinition tag = new StubLineTagWithRegionDefinition("stubLineTagTitle");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
LineTag lineTag = doclet.getLineTags().get(0);
TagValue region = lineTag.getValueByKey(StubLineTagWithRegionDefinition.REGION);
Text strcturedText = (Text) region.getContents().get(0);
assertEquals("@region value", strcturedText.getText());
TagValue vDescription = lineTag.getValueByKey(StubLineTagWithRegionDefinition.DESCR);
Text tabDescription = (Text) vDescription.getContents().get(0);
String deString = tabDescription.getText();
assertEquals("tag description. ", deString);
}
use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.
the class LineTagWithFullMemberReferenceTest method test_fullRef_simpleName.
@SuppressWarnings("javadoc")
@Test
public void test_fullRef_simpleName() {
String in = "/** foo." + "\n * @testee n4/model/collections/DataSet.DataSet.each" + "\n */";
AbstractLineTagDefinition tagDef = new LineTagWithFullMemberReference("testee");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tagDef)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
LineTag lineTag = doclet.getLineTags().get(0);
EList<ContentNode> contents = lineTag.getValueByKey(LineTagWithFullElementReference.REF).getContents();
FullMemberReference ref = (FullMemberReference) contents.get(0);
assertEquals("n4/model/collections/DataSet", ref.getModuleName());
assertEquals("DataSet", ref.getTypeName());
assertEquals("each", ref.getMemberName());
}
use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.
the class SimpleN4JSDocTest method assertSameSerializationForm.
/**
* @param jsdocString
* jsDoc string
*/
private void assertSameSerializationForm(String jsdocString) {
DocletParser docletParser = new N4JSDocletParser();
Doclet doclet = docletParser.parse(jsdocString);
String out = JSDocSerializer.toJSDocString(doclet);
assertEquals(jsdocString, out);
}
Aggregations