From: mkersten Date: Tue, 27 Jul 2004 17:38:25 +0000 (+0000) Subject: Added declare parents relationship test, party commented out and waiting on Andy... X-Git-Tag: for_ajdt1_1_12~92 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c143eb5ec12a8ee9cf480e8bf4a4e12acef38d40;p=aspectj.git Added declare parents relationship test, party commented out and waiting on Andy's merge. --- diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java index 3f16c6264..407ad1004 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java @@ -12,8 +12,11 @@ package org.aspectj.ajde; import java.util.Iterator; +import java.util.List; -import org.aspectj.asm.*; +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; // TODO: check for return types public class AsmRelationshipsTest extends AjdeTestCase { @@ -25,11 +28,32 @@ public class AsmRelationshipsTest extends AjdeTestCase { super(name); } + public void testDeclareParents() { + IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "DeclareCoverage"); +// System.err.println(aspect.getChildren()); + + IProgramElement dp = manager.getHierarchy().findElementForLabel( + aspect, + IProgramElement.Kind.DECLARE_PARENTS, + "declare parents: Point"); + + assertNotNull(dp); + List relations = manager.getRelationshipMap().get(dp); + +// assertTrue(false); + +// assertTrue(rel.getTargets().size() > 0); +// +// checkDeclareMapping("DeclareCoverage", "Point", , +// "Point", "matched by", "matches declare", +// IProgramElement.Kind.DECLARE_PARENTS); + } + public void testDeclareWarningAndError() { checkDeclareMapping("DeclareCoverage", "Point", "declare warning: \"Illegal call.\"", "method-call(void Point.setX(int))", "matched by", "matches declare", IProgramElement.Kind.DECLARE_WARNING); } - + public void testInterTypeDeclarations() { checkInterTypeMapping("InterTypeDecCoverage", "Point", "Point.xxx", "Point", "declared on", "aspect declarations", IProgramElement.Kind.INTER_TYPE_FIELD); @@ -55,6 +79,7 @@ public class AsmRelationshipsTest extends AjdeTestCase { IProgramElement beforeExecNode = manager.getHierarchy().findElementForLabel(aspect, kind, beforeExec); assertNotNull(beforeExecNode); IRelationship rel = manager.getRelationshipMap().get(beforeExecNode, IRelationship.Kind.DECLARE, forwardRelName); + assertTrue(rel.getTargets().size() > 0); String handle = (String)rel.getTargets().get(0); assertEquals(manager.getHierarchy().findElementForHandle(handle).toString(), to);