use of org.eclipse.n4js.jsdoc.dom.Text 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.dom.Text 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.Text 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());
}
use of org.eclipse.n4js.jsdoc.dom.Text in project n4js by eclipse.
the class DocletParserTest method testTrailingDescriptionIsIgnored.
@SuppressWarnings("javadoc")
@Test
public void testTrailingDescriptionIsIgnored() {
String in = "/** This is the description.\n * @stubLineTagTitle \n * Trailing description.\n */";
AbstractLineTagDefinition tag = new StubLineTagDefinition("stubLineTagTitle");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
assertEquals(1, doclet.getContents().size());
assertEquals(1, doclet.getContents().size());
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());
}
use of org.eclipse.n4js.jsdoc.dom.Text 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