use of org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition in project n4js by eclipse.
the class DocletDescriptionParserTest method testParserResumesAfterUnkownInlineTag.
@SuppressWarnings("javadoc")
@Test
public void testParserResumesAfterUnkownInlineTag() {
String in = "/** This is the description with {@unkonwnInlineTag parsed as text} ... text in between... {@inline tag description} ..and finish description. \n */";
AbstractInlineTagDefinition inlineTag = new StubInlineTagDefinition("inline");
DocletParser docletParser = new DocletParser(null, new TagDictionary<>(Arrays.asList(inlineTag)));
Doclet doclet = docletParser.parse(in);
EList<ContentNode> contents = doclet.getContents();
Composite composite = (Composite) contents.get(0);
ContentNode node0 = composite.getContents().get(0);
ContentNode node1 = composite.getContents().get(1);
ContentNode node2 = composite.getContents().get(2);
Text descriptionText1 = (Text) node0;
InlineTag descriptionInlineTag = (InlineTag) node1;
Text descriptionText2 = (Text) node2;
assertEquals("This is the description with {@unkonwnInlineTag parsed as text} ... text in between... ", descriptionText1.getText());
assertEquals(" ..and finish description.", descriptionText2.getText());
TagValue inlineDescription = descriptionInlineTag.getValueByKey(StubInlineTagDefinition.PARAM_VALUE);
Text tValue = (Text) inlineDescription.getContents().get(0);
assertEquals(" tag description", tValue.getText());
}
use of org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition in project n4js by eclipse.
the class DocletDescriptionParserTest method testDescriptionWithInline.
@SuppressWarnings("javadoc")
@Test
public void testDescriptionWithInline() {
String in = "/** This is the description with {@inline tag description} ..and finish description. \n */";
AbstractInlineTagDefinition inlineTag = new StubInlineTagDefinition("inline");
DocletParser docletParser = new DocletParser(null, new TagDictionary<>(Arrays.asList(inlineTag)));
Doclet doclet = docletParser.parse(in);
EList<ContentNode> contents = doclet.getContents();
Composite composite = (Composite) contents.get(0);
ContentNode node0 = composite.getContents().get(0);
ContentNode node1 = composite.getContents().get(1);
ContentNode node2 = composite.getContents().get(2);
Text descriptionText1 = (Text) node0;
InlineTag descriptionInlineTag = (InlineTag) node1;
Text descriptionText2 = (Text) node2;
assertEquals("This is the description with ", descriptionText1.getText());
assertEquals(" ..and finish description.", descriptionText2.getText());
TagValue inlineDescription = descriptionInlineTag.getValueByKey(StubInlineTagDefinition.PARAM_VALUE);
Text tValue = (Text) inlineDescription.getContents().get(0);
assertEquals(" tag description", tValue.getText());
}
use of org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition 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.tags.AbstractInlineTagDefinition in project n4js by eclipse.
the class DocletParserTest method testJSDocParsingWithoutLineTags.
@SuppressWarnings("javadoc")
@Test
public void testJSDocParsingWithoutLineTags() {
String in = "/** Just free text.\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("Just free text.", descr.getText());
}
use of org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition 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());
}
Aggregations