use of org.eclipse.n4js.jsdoc.dom.LineTag 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.dom.LineTag in project n4js by eclipse.
the class DocletParserTest method testJSDocParsingWithManyLineTags.
@SuppressWarnings("javadoc")
@Test
public void testJSDocParsingWithManyLineTags() {
String in = "/** \n * @stubLineTagTitle0 \n * @stubLineTagTitle1 \n * @stubLineTagTitle2 \n */";
AbstractLineTagDefinition tag0 = new StubLineTagDefinition("stubLineTagTitle0");
AbstractLineTagDefinition tag1 = new StubLineTagDefinition("stubLineTagTitle1");
AbstractLineTagDefinition tag2 = new StubLineTagDefinition("stubLineTagTitle2");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag0, tag1, tag2)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
EList<LineTag> lineTags = doclet.getLineTags();
assertEquals(3, lineTags.size());
// assuming that list is as parsing order
LineTag lineTag0 = lineTags.get(0);
assertEquals("stubLineTagTitle0", lineTag0.getTitle().getTitle());
LineTag lineTag1 = lineTags.get(1);
assertEquals("stubLineTagTitle1", lineTag1.getTitle().getTitle());
LineTag lineTag2 = lineTags.get(2);
assertEquals("stubLineTagTitle2", lineTag2.getTitle().getTitle());
}
use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.
the class DocletParserTest method testTrailingDescriptionAndAllThatFollowsIsIgnored.
@SuppressWarnings("javadoc")
@Test
public void testTrailingDescriptionAndAllThatFollowsIsIgnored() {
String in = "/** This is the description." + "\n * @stubLineTagTitle " + "\n * Trailing description." + "\n * @stubLineTagTitle2 " + "\n */";
AbstractLineTagDefinition tag = new StubLineTagDefinition("stubLineTagTitle");
AbstractLineTagDefinition tag2 = new StubLineTagDefinition("stubLineTagTitle2");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag, tag2)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
assertEquals(1, doclet.getContents().size());
Text descr = (Text) doclet.getContents().get(0);
assertEquals("This is the description.", descr.getText());
assertEquals(2, doclet.getLineTags().size());
LineTag lineTag = doclet.getLineTags().get(0);
assertEquals("stubLineTagTitle", lineTag.getTitle().getTitle());
}
use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.
the class DocletParserTest method testParserResumesAfterUnkonwLineTag.
@SuppressWarnings("javadoc")
@Test
public void testParserResumesAfterUnkonwLineTag() {
String in = "/** \n * @unkonwLineTag \n * @stubLineTagTitle1 \n * @stubLineTagTitle2 \n */";
AbstractLineTagDefinition tag0 = new StubLineTagDefinition("stubLineTagTitle0");
AbstractLineTagDefinition tag1 = new StubLineTagDefinition("stubLineTagTitle1");
AbstractLineTagDefinition tag2 = new StubLineTagDefinition("stubLineTagTitle2");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag0, tag1, tag2)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
EList<LineTag> lineTags = doclet.getLineTags();
assertEquals(2, lineTags.size());
// assuming that list is as parsing order
LineTag lineTag1 = lineTags.get(0);
assertEquals("stubLineTagTitle1", lineTag1.getTitle().getTitle());
LineTag lineTag2 = lineTags.get(1);
assertEquals("stubLineTagTitle2", lineTag2.getTitle().getTitle());
}
use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.
the class DocletParserTest method testJSDocParsing.
@SuppressWarnings("javadoc")
@Test
public void testJSDocParsing() {
String in = "/** This is the description.\n * @stubLineTagTitle \n */";
AbstractLineTagDefinition tag = new StubLineTagDefinition("stubLineTagTitle");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
Text descr = (Text) doclet.getContents().get(0);
assertEquals("This is the description.", descr.getText());
LineTag lineTag = doclet.getLineTags().get(0);
assertEquals("stubLineTagTitle", lineTag.getTitle().getTitle());
}
Aggregations