Search in sources :

Example 6 with DocletParser

use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.

the class SimpleN4JSDocTest method testWhitespaces_IDEBUG_571_b.

@SuppressWarnings("javadoc")
@Test
public void testWhitespaces_IDEBUG_571_b() {
    String in = "/**\n" + " * X\n" + " * \n" + " * @testeeType Y\n" + " */";
    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 7 with DocletParser

use of org.eclipse.n4js.jsdoc.DocletParser 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 8 with DocletParser

use of org.eclipse.n4js.jsdoc.DocletParser 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());
}
Also used : Composite(org.eclipse.n4js.jsdoc.dom.Composite) Text(org.eclipse.n4js.jsdoc.dom.Text) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode) InlineTag(org.eclipse.n4js.jsdoc.dom.InlineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) TagValue(org.eclipse.n4js.jsdoc.dom.TagValue) Test(org.junit.Test)

Example 9 with DocletParser

use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.

the class LineTagWithFullMemberReferenceTest method test_fullRef_symbolName.

@SuppressWarnings("javadoc")
@Test
public void test_fullRef_symbolName() {
    String in = "/** foo." + "\n * @testee n4/model/collections/DataSet.DataSet.#iterator" + "\n */";
    AbstractLineTagDefinition tagDef = new LineTagWithFullMemberReference("testee");
    DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tagDef)), new TagDictionary<AbstractInlineTagDefinition>());
    Doclet doclet = docletParser.parse(in);
    LineTag lineTag = doclet.getLineTags().get(0);
    EList<ContentNode> contents = lineTag.getValueByKey(LineTagWithFullElementReference.REF).getContents();
    FullMemberReference ref = (FullMemberReference) contents.get(0);
    assertEquals("n4/model/collections/DataSet", ref.getModuleName());
    assertEquals("DataSet", ref.getTypeName());
    assertEquals("#iterator", ref.getMemberName());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode) FullMemberReference(org.eclipse.n4js.jsdoc.dom.FullMemberReference) Test(org.junit.Test)

Example 10 with DocletParser

use of org.eclipse.n4js.jsdoc.DocletParser in project n4js by eclipse.

the class SimpleN4JSDocTest method assertSameNumberOfLineTags.

private void assertSameNumberOfLineTags(int expectedNumberOfTags, String jsdocString) {
    DocletParser docletParser = new N4JSDocletParser();
    Doclet doclet = docletParser.parse(jsdocString);
    assertEquals("Line tag number differs", expectedNumberOfTags, doclet.getLineTags().size());
}
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)

Aggregations

DocletParser (org.eclipse.n4js.jsdoc.DocletParser)11 Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)11 Test (org.junit.Test)9 LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)6 Text (org.eclipse.n4js.jsdoc.dom.Text)6 N4JSDocletParser (org.eclipse.n4js.jsdoc.N4JSDocletParser)4 TagValue (org.eclipse.n4js.jsdoc.dom.TagValue)4 ContentNode (org.eclipse.n4js.jsdoc.dom.ContentNode)3 FullMemberReference (org.eclipse.n4js.jsdoc.dom.FullMemberReference)2 Composite (org.eclipse.n4js.jsdoc.dom.Composite)1 InlineTag (org.eclipse.n4js.jsdoc.dom.InlineTag)1