Search in sources :

Example 6 with AbstractLineTagDefinition

use of org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition 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());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) AbstractLineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition) AbstractInlineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) Text(org.eclipse.n4js.jsdoc.dom.Text) Test(org.junit.Test)

Example 7 with AbstractLineTagDefinition

use of org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition in project n4js by eclipse.

the class DocletParserTest method testJSDocParsingWithoutMainDescription.

@SuppressWarnings("javadoc")
@Test
public void testJSDocParsingWithoutMainDescription() {
    String in = "/** \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);
    LineTag lineTag = doclet.getLineTags().get(0);
    assertEquals("stubLineTagTitle", lineTag.getTitle().getTitle());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) AbstractLineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition) AbstractInlineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) Test(org.junit.Test)

Example 8 with AbstractLineTagDefinition

use of org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition in project n4js by eclipse.

the class DocletParserTest method testUnkonwLineTagIsIgnored.

@SuppressWarnings("javadoc")
@Test
public void testUnkonwLineTagIsIgnored() {
    String in = "/** \n * @unkonwTagTitle \n */";
    AbstractLineTagDefinition tag = new StubLineTagDefinition("stubLineTagTitle");
    DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
    Doclet doclet = docletParser.parse(in);
    assertEquals(0, doclet.getLineTags().size());
}
Also used : AbstractLineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition) AbstractInlineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) Test(org.junit.Test)

Aggregations

Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)8 AbstractInlineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition)8 AbstractLineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition)8 Test (org.junit.Test)8 LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)6 Text (org.eclipse.n4js.jsdoc.dom.Text)4