Search in sources :

Example 16 with LineTag

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

the class LineTagTest method testLineTagWithRegion.

@SuppressWarnings("javadoc")
@Test
public void testLineTagWithRegion() {
    String in = "/** foo.\n * @stubLineTagTitle {@region value} \n */";
    AbstractLineTagDefinition tag = new StubLineTagWithRegionDefinition("stubLineTagTitle");
    DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
    Doclet doclet = docletParser.parse(in);
    LineTag lineTag = doclet.getLineTags().get(0);
    TagValue region = lineTag.getValueByKey(StubLineTagWithRegionDefinition.REGION);
    Text strcturedText = (Text) region.getContents().get(0);
    assertEquals("@region value", strcturedText.getText());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) Text(org.eclipse.n4js.jsdoc.dom.Text) TagValue(org.eclipse.n4js.jsdoc.dom.TagValue) Test(org.junit.Test)

Example 17 with LineTag

use of org.eclipse.n4js.jsdoc.dom.LineTag 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 18 with LineTag

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

the class N4JSDReader method processClassifier.

private void processClassifier(Multimap<String, SpecInfo> specInfoByName, Type testType, TClassifier ctype) {
    RepoRelativePath rrp = RepoRelativePath.compute(testType.eResource(), n4jsCore);
    Doclet testTypeDoclet = n4jsDocHelper.getDoclet(ctype.getAstElement());
    Collection<FullMemberReference> testeeRefsFromType = getFullMemberRefsFromType(testTypeDoclet);
    Collection<FullMemberReference> testeeTypeRefsFromType = getFullTypeRefsFromType(testTypeDoclet);
    MemberList<TMember> allMembers = containerTypesHelper.fromContext(testType).allMembers(ctype, false, false);
    for (TMember testMember : allMembers) {
        boolean isOwnedMember = testMember.getContainingType() == ctype;
        if (testMember instanceof TMethod && AnnotationDefinition.TEST_METHOD.hasAnnotation(testMember)) {
            EObject astElement = testMember.getAstElement();
            if (!astElement.eIsProxy()) {
                Doclet testMethodDoclet = n4jsDocHelper.getDoclet(astElement);
                LineTag tag = findLinkToElementTag(testMethodDoclet, isOwnedMember);
                if (tag != null) {
                    processTag(specInfoByName, rrp, testeeRefsFromType, testeeTypeRefsFromType, testMember, isOwnedMember, astElement, testMethodDoclet, tag);
                }
            } else {
                System.err.println("cannot result AST when scanning for doclets: " + astElement);
            }
        }
    }
}
Also used : TMethod(org.eclipse.n4js.ts.types.TMethod) LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) EObject(org.eclipse.emf.ecore.EObject) TMember(org.eclipse.n4js.ts.types.TMember) FullMemberReference(org.eclipse.n4js.jsdoc.dom.FullMemberReference)

Example 19 with LineTag

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

the class AbstractLineTagDefinition method createLineTag.

/**
 * Convenience method.
 */
protected LineTag createLineTag(TagTitle tagTitle) {
    LineTag tag = DOM.createLineTag();
    tag.setTagDefinition(this);
    tag.setTitle(tagTitle);
    return tag;
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag)

Aggregations

LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)19 Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)14 Test (org.junit.Test)12 DocletParser (org.eclipse.n4js.jsdoc.DocletParser)6 Text (org.eclipse.n4js.jsdoc.dom.Text)6 AbstractInlineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition)6 AbstractLineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition)6 FullMemberReference (org.eclipse.n4js.jsdoc.dom.FullMemberReference)3 TagValue (org.eclipse.n4js.jsdoc.dom.TagValue)3 ContentNode (org.eclipse.n4js.jsdoc.dom.ContentNode)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 TagTitle (org.eclipse.n4js.jsdoc.dom.TagTitle)1 TagTitleTokenizer (org.eclipse.n4js.jsdoc.tokenizers.TagTitleTokenizer)1 TMember (org.eclipse.n4js.ts.types.TMember)1 TMethod (org.eclipse.n4js.ts.types.TMethod)1 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)1