diff options
author | aclement <aclement> | 2009-03-24 16:50:44 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-03-24 16:50:44 +0000 |
commit | 3eb475ccd3fcd641ef0aa6c543314ec0a26f5fe4 (patch) | |
tree | ca4617298e1a91c3e092670aa03c84fad68c2d96 | |
parent | 7a7d6f0f1e81e6639bdaa4f278b4778b984ad175 (diff) | |
download | aspectj-3eb475ccd3fcd641ef0aa6c543314ec0a26f5fe4.tar.gz aspectj-3eb475ccd3fcd641ef0aa6c543314ec0a26f5fe4.zip |
265693: better test
5 files changed, 49 insertions, 23 deletions
diff --git a/tests/multiIncremental/AspectPath3/base/src/Asp2.java b/tests/multiIncremental/AspectPath3/base/src/Asp2.java deleted file mode 100644 index dcaf6ca92..000000000 --- a/tests/multiIncremental/AspectPath3/base/src/Asp2.java +++ /dev/null @@ -1,17 +0,0 @@ -public aspect Asp2 { - - - - - - - - - - - - - - - before(): execution(* fo*(..)) {} -} diff --git a/tests/multiIncremental/AspectPath3/base/src/a/b/c/Asp.java b/tests/multiIncremental/AspectPath3/base/src/a/b/c/Asp.java new file mode 100644 index 000000000..b13c29699 --- /dev/null +++ b/tests/multiIncremental/AspectPath3/base/src/a/b/c/Asp.java @@ -0,0 +1,7 @@ +package a.b.c; + +aspect Asp { +// before(): staticinitialization(*) {} + + int C.i = 5; +} diff --git a/tests/multiIncremental/AspectPath3/base/src/a/b/c/C.java b/tests/multiIncremental/AspectPath3/base/src/a/b/c/C.java new file mode 100644 index 000000000..d00e09976 --- /dev/null +++ b/tests/multiIncremental/AspectPath3/base/src/a/b/c/C.java @@ -0,0 +1,4 @@ +package a.b.c; + +class C { +} diff --git a/tests/multiIncremental/AspectPath4/base/src/a/b/c/C.java b/tests/multiIncremental/AspectPath4/base/src/a/b/c/C.java new file mode 100644 index 000000000..ab41297aa --- /dev/null +++ b/tests/multiIncremental/AspectPath4/base/src/a/b/c/C.java @@ -0,0 +1,12 @@ +package a.b.c; +import java.util.List; +import java.lang.annotation.Retention; +import org.aspectj.lang.annotation.Around; + +public class C { + public static void main(String []argv) { + new C().foo(); + } + + public void foo() {} +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index e3a5f3e38..f411411f4 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -976,13 +976,33 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa configureAspectPath(bug2, getProjectRelativePath(bug, "bin")); build(bug); build(bug2); - dumptree(getModelFor(bug2).getHierarchy().getRoot(), 0); - PrintWriter pw = new PrintWriter(System.out); - getModelFor(bug2).dumprels(pw); - pw.flush(); + // dumptree(getModelFor(bug2).getHierarchy().getRoot(), 0); + // PrintWriter pw = new PrintWriter(System.out); + // getModelFor(bug2).dumprels(pw); + // pw.flush(); IProgramElement root = getModelFor(bug2).getHierarchy().getRoot(); - assertEquals("=AspectPath4/binaries<pkg(Asp.class}Asp&before", findElementAtLine(root, 5).getHandleIdentifier()); - assertEquals("=AspectPath4/binaries<(Asp2.class}Asp2&before", findElementAtLine(root, 16).getHandleIdentifier()); + IProgramElement binariesNode = getChild(root, "binaries"); + assertNotNull(binariesNode); + IProgramElement packageNode = (IProgramElement) binariesNode.getChildren().get(0); + assertEquals("a.b.c", packageNode.getName()); + IProgramElement fileNode = (IProgramElement) packageNode.getChildren().get(0); + assertEquals(IProgramElement.Kind.FILE, fileNode.getKind()); + } + + private IProgramElement getChild(IProgramElement start, String name) { + if (start.getName().equals(name)) { + return start; + } + List kids = start.getChildren(); + if (kids != null) { + for (int i = 0; i < kids.size(); i++) { + IProgramElement found = getChild((IProgramElement) kids.get(i), name); + if (found != null) { + return found; + } + } + } + return null; } public void testHandleQualification_pr265993() throws IOException { |