Search in sources :

Example 11 with Doclet

use of org.eclipse.n4js.jsdoc.dom.Doclet in project n4js by eclipse.

the class SimpleN4JSDocTest method testWhitespaces_IDEBUG_571_a.

@SuppressWarnings("javadoc")
@Test
public void testWhitespaces_IDEBUG_571_a() {
    String in = "/**\n" + " * X\n" + " *\n" + " * @testeeType Y" + " */";
    DocletParser docletParser = new N4JSDocletParser();
    Doclet doclet = docletParser.parse(in);
    String descr = ((Text) doclet.getContents().get(0)).getText();
    assertEquals("X", descr);
    assertSameNumberOfLineTags(1, doclet);
}
Also used : N4JSDocletParser(org.eclipse.n4js.jsdoc.N4JSDocletParser) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) N4JSDocletParser(org.eclipse.n4js.jsdoc.N4JSDocletParser) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) Text(org.eclipse.n4js.jsdoc.dom.Text) Test(org.junit.Test)

Example 12 with Doclet

use of org.eclipse.n4js.jsdoc.dom.Doclet 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());
}
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 13 with Doclet

use of org.eclipse.n4js.jsdoc.dom.Doclet 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());
}
Also used : 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 14 with Doclet

use of org.eclipse.n4js.jsdoc.dom.Doclet 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());
}
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 15 with Doclet

use of org.eclipse.n4js.jsdoc.dom.Doclet 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());
}
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)

Aggregations

Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)28 Test (org.junit.Test)21 LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)14 Text (org.eclipse.n4js.jsdoc.dom.Text)14 DocletParser (org.eclipse.n4js.jsdoc.DocletParser)11 AbstractInlineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition)11 ContentNode (org.eclipse.n4js.jsdoc.dom.ContentNode)8 AbstractLineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition)8 TagValue (org.eclipse.n4js.jsdoc.dom.TagValue)6 N4JSDocletParser (org.eclipse.n4js.jsdoc.N4JSDocletParser)5 FullMemberReference (org.eclipse.n4js.jsdoc.dom.FullMemberReference)4 Composite (org.eclipse.n4js.jsdoc.dom.Composite)3 InlineTag (org.eclipse.n4js.jsdoc.dom.InlineTag)3 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 TMember (org.eclipse.n4js.ts.types.TMember)2 Optional (java.util.Optional)1 EcoreUtil (org.eclipse.emf.ecore.util.EcoreUtil)1 ITextViewer (org.eclipse.jface.text.ITextViewer)1 CompletionProposal (org.eclipse.jface.text.contentassist.CompletionProposal)1