]> source.dussan.org Git - aspectj.git/commitdiff
Added declare parents relationship test, party commented out and waiting on Andy...
authormkersten <mkersten>
Tue, 27 Jul 2004 17:38:25 +0000 (17:38 +0000)
committermkersten <mkersten>
Tue, 27 Jul 2004 17:38:25 +0000 (17:38 +0000)
ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java

index 3f16c6264b130df5dd80d32ca4cd4489791fa83b..407ad100417055cbbbf7ede124cf4cc19bd3c369 100644 (file)
 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);