diff options
author | mkersten <mkersten> | 2003-08-16 03:14:36 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-08-16 03:14:36 +0000 |
commit | eb12f56518d08c54fc17047749a5d2d66b3c4181 (patch) | |
tree | 40dd436a6848d69b5db2cfb0741a76fcfecfc194 /ajde | |
parent | 466cb82c3ba6cf23e28bb8b8e8da0e54a90486b2 (diff) | |
download | aspectj-eb12f56518d08c54fc17047749a5d2d66b3c4181.tar.gz aspectj-eb12f56518d08c54fc17047749a5d2d66b3c4181.zip |
Added spacewar project for testing.
Diffstat (limited to 'ajde')
-rw-r--r-- | ajde/testdata/examples/coverage/ModelCoverage.java | 2 | ||||
-rw-r--r-- | ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java | 2 | ||||
-rw-r--r-- | ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java | 27 |
3 files changed, 29 insertions, 2 deletions
diff --git a/ajde/testdata/examples/coverage/ModelCoverage.java b/ajde/testdata/examples/coverage/ModelCoverage.java index bb977e36c..51fb54b89 100644 --- a/ajde/testdata/examples/coverage/ModelCoverage.java +++ b/ajde/testdata/examples/coverage/ModelCoverage.java @@ -107,7 +107,7 @@ aspect DeclareCoverage { pointcut illegalNewFigElt(): call(Point.new(..)) && !withincode(* *.doIt(..)); declare error: illegalNewFigElt(): "Illegal constructor call."; - declare warning: illegalNewFigElt(): "Illegal constructor call."; + declare warning: call(* Point.setX(..)): "Illegal call."; declare parents: Point extends java.io.Serializable; declare parents: Point+ implements java.util.Observable; diff --git a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java index 9d7bdf79c..028d84140 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java @@ -55,7 +55,7 @@ public class AsmDeclarationsTest extends AjdeTestCase { assertNotNull(decErrNode); assertEquals(decErrNode.toLabelString(), label); - String decWarnMessage = "declare warning: \"Illegal construct..\""; + String decWarnMessage = "declare warning: \"Illegal call.\""; IProgramElement decWarnNode = model.findElementForSignature(aspect, IProgramElement.Kind.DECLARE_WARNING, "declare warning"); assertNotNull(decWarnNode); assertEquals(decWarnNode.toLabelString(), decWarnMessage); diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java index 85df30d08..f4b41a846 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java @@ -24,6 +24,11 @@ public class AsmRelationshipsTest extends AjdeTestCase { public AsmRelationshipsTest(String name) { super(name); } + + 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", @@ -41,6 +46,28 @@ public class AsmRelationshipsTest extends AjdeTestCase { "field-set(int Point.x)", "advises"); } + private void checkDeclareMapping(String fromType, String toType, String from, String to, + String forwardRelName, String backRelName, IProgramElement.Kind kind) { + + IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, fromType); + assertNotNull(aspect); + String beforeExec = from; + IProgramElement beforeExecNode = manager.getHierarchy().findElementForLabel(aspect, kind, beforeExec); + assertNotNull(beforeExecNode); + IRelationship rel = manager.getRelationshipMap().get(beforeExecNode, IRelationship.Kind.DECLARE, forwardRelName); + String handle = (String)rel.getTargets().get(0); + assertEquals(manager.getHierarchy().findElementForHandle(handle).toString(), to); + + IProgramElement clazz = AsmManager.getDefault().getHierarchy().findElementForType(null, toType); + assertNotNull(clazz); + String set = to; + IProgramElement setNode = manager.getHierarchy().findElementForLabel(clazz, IProgramElement.Kind.CODE, set); + assertNotNull(setNode); + IRelationship rel2 = manager.getRelationshipMap().get(setNode, IRelationship.Kind.DECLARE, backRelName); + String handle2 = (String)rel2.getTargets().get(0); + assertEquals(manager.getHierarchy().findElementForHandle(handle2).toString(), from); + } + private void checkUniDirectionalMapping(String fromType, String toType, String from, String to, String relName) { |