diff options
author | aclement <aclement> | 2006-01-20 10:52:29 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-01-20 10:52:29 +0000 |
commit | 1361dea02a5de3a4da611fe429f48f7fc2afe048 (patch) | |
tree | 007af0bef2e83ae7138d44543acae83abc0df271 /tests | |
parent | 9bfea799f7a54b78115111e4c6d44a67536e23ca (diff) | |
download | aspectj-1361dea02a5de3a4da611fe429f48f7fc2afe048.tar.gz aspectj-1361dea02a5de3a4da611fe429f48f7fc2afe048.zip |
77166 - newarray joinpoint support. "-Xjoinpoints:arrayconstruction"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java | 24 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml | 1 |
2 files changed, 22 insertions, 3 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java b/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java index 4db134003..b4c363d81 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java @@ -11,9 +11,12 @@ package org.aspectj.systemtest.ajc151; import java.io.File; +import java.util.List; import junit.framework.Test; +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IProgramElement; import org.aspectj.testing.XMLBasedAjcTestCase; /* @@ -55,14 +58,29 @@ public class NewarrayJoinpointTests extends XMLBasedAjcTestCase { public void testBasicWithAMultiDimensionalArray() { runTest("multi dimensional array creation"); } public void testArgsWithAMultiDimensionalArray() { runTest("multi dimensional array args");} - // complicated + // various + public void testOptionoff() { runTest("option deactivated - no match expected");} public void testUsingTargetAndAfterReturningAdvice() { runTest("using target and after returning");} public void testUsingItForReal() { runTest("using it for real");} public void testDifferentiatingArrayTypes() { runTest("differentiating array types");} - public void testStructureModel() { runTest("structure model");} + + public void testStructureModel() { + //AsmManager.setReporting("c:/foo.txt",true,true,true,true); + runTest("structure model"); + IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForType("","Five"); + assertTrue("Couldnt find 'Five' type in the model",ipe!=null); + List kids = ipe.getChildren(); + assertTrue("Couldn't find 'main' method in the 'Five' type",kids!=null && kids.size()==1); + List codenodes = ((IProgramElement)kids.get(0)).getChildren(); + assertTrue("Couldn't find nodes below 'main' method",codenodes!=null && codenodes.size()==1); + IProgramElement arrayCtorCallNode = (IProgramElement)codenodes.get(0); + String exp = "constructor-call(void java.lang.Integer[].<init>(int))"; + assertTrue("Expected '"+exp+"' but found "+arrayCtorCallNode.toString(),arrayCtorCallNode.toString().equals(exp)); + List rels = AsmManager.getDefault().getRelationshipMap().get(arrayCtorCallNode); + assertTrue("Should have a relationship from the ctorcall node, but didn't find one?",rels!=null && rels.size()==1); + } - public void testOptionoff() { runTest("option deactivated - no match expected");} // public static Test suite() { diff --git a/tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml b/tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml index b75d4adec..fb11fa596 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml @@ -157,6 +157,7 @@ <ajc-test dir="features151/newarrayjoinpoint" title="option deactivated - no match expected"> <compile files="One.java" options="-1.5 -showWeaveInfo"> <message kind="warning" line="9" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="9" text="There are no join points for array construction unless -Xjoinpoints:arrayconstruction is specified"/> </compile> </ajc-test> |