use of org.eclipse.n4js.jsdoc.dom.Composite 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.dom.Composite 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.dom.Composite in project n4js by eclipse.
the class InlineTagTest method testSimpleLineTag.
@SuppressWarnings("javadoc")
@Test
public void testSimpleLineTag() {
String in = "/** Some Description {@inline me} some other text. \n */";
AbstractInlineTagDefinition tag = new StubInlineTagDefinition("inline");
DocletParser docletParser = new DocletParser(new TagDictionary<AbstractLineTagDefinition>(), new TagDictionary<>(Arrays.asList(tag)));
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("Some Description ", descriptionText1.getText());
assertEquals(" some other text.", descriptionText2.getText());
TagValue inlineDescription = descriptionInlineTag.getValueByKey(StubInlineTagDefinition.PARAM_VALUE);
Text tValue = (Text) inlineDescription.getContents().get(0);
assertEquals(" me", tValue.getText());
}
Aggregations