From 0b6d41c5a5a35c567f6ef391d4579c701d65d7be Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 7 Nov 2005 11:22:49 +0000 Subject: [PATCH] test for pr113531. test patch is from Helen. Currently commented out in MultiProjectIncrementalTests --- .../PR113531/base/src/pack1/A.aj | 7 +++++++ .../PR113531/base/src/pack1/A1.aj | 9 +++++++++ .../PR113531/inc1/src/pack1/A.aj | 7 +++++++ .../PR113531/inc2/src/pack1/A3.aj | 5 +++++ .../tools/AjdeInteractionTestbed.java | 9 ++++++++- .../tools/MultiProjectIncrementalTests.java | 18 ++++++++++++++++++ 6 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/multiIncremental/PR113531/base/src/pack1/A.aj create mode 100644 tests/multiIncremental/PR113531/base/src/pack1/A1.aj create mode 100644 tests/multiIncremental/PR113531/inc1/src/pack1/A.aj create mode 100644 tests/multiIncremental/PR113531/inc2/src/pack1/A3.aj diff --git a/tests/multiIncremental/PR113531/base/src/pack1/A.aj b/tests/multiIncremental/PR113531/base/src/pack1/A.aj new file mode 100644 index 000000000..489fa4d1a --- /dev/null +++ b/tests/multiIncremental/PR113531/base/src/pack1/A.aj @@ -0,0 +1,7 @@ +package pack1; + +public abstract aspect A { + + protected int foo; + +} diff --git a/tests/multiIncremental/PR113531/base/src/pack1/A1.aj b/tests/multiIncremental/PR113531/base/src/pack1/A1.aj new file mode 100644 index 000000000..864dda167 --- /dev/null +++ b/tests/multiIncremental/PR113531/base/src/pack1/A1.aj @@ -0,0 +1,9 @@ +package pack1; + +public aspect A1 extends A { + + private void bar () { + foo = 2; + } + +} diff --git a/tests/multiIncremental/PR113531/inc1/src/pack1/A.aj b/tests/multiIncremental/PR113531/inc1/src/pack1/A.aj new file mode 100644 index 000000000..7e8543dcd --- /dev/null +++ b/tests/multiIncremental/PR113531/inc1/src/pack1/A.aj @@ -0,0 +1,7 @@ +package pack1; + +public abstract aspect A { + + private int foo; + +} diff --git a/tests/multiIncremental/PR113531/inc2/src/pack1/A3.aj b/tests/multiIncremental/PR113531/inc2/src/pack1/A3.aj new file mode 100644 index 000000000..4e65eea8d --- /dev/null +++ b/tests/multiIncremental/PR113531/inc2/src/pack1/A3.aj @@ -0,0 +1,5 @@ +package pack1; + +public aspect A3 { + +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index 902028862..146793f26 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -267,6 +267,8 @@ public class AjdeInteractionTestbed extends TestCase { static class MyErrorHandler implements ErrorHandler { static MyErrorHandler _instance = new MyErrorHandler(); + private List errorMessages = new ArrayList(); + private MyErrorHandler() {} public static ErrorHandler getInstance() { @@ -279,12 +281,17 @@ public class AjdeInteractionTestbed extends TestCase { public void handleError(String message) { log("ErrorHandler.handleWarning("+message+")"); - + errorMessages.add(message); } public void handleError(String message, Throwable t) { log("ErrorHandler.handleError("+message+","+t+")"); if (VERBOSE) t.printStackTrace(); + errorMessages.add(message+","+t+")"); + } + + public static List/*String*/ getErrorMessages() { + return _instance.errorMessages; } } diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 706410f40..a5813ea10 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -23,6 +23,7 @@ import org.aspectj.ajdt.internal.core.builder.AjState; import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager; import org.aspectj.asm.AsmManager; import org.aspectj.asm.IProgramElement; +import org.aspectj.bridge.IMessage; import org.aspectj.testing.util.FileUtil; /** @@ -296,6 +297,23 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { build("PR111779"); } */ + +// public void testPr113531() { +// initialiseProject("PR113531"); +// build("PR113531"); +// assertFalse("build should have compiled ok", +// MyTaskListManager.hasErrorMessages()); +// alter("PR113531","inc1"); +// build("PR113531"); +// assertEquals("error message should be 'foo cannot be resolved' ", +// "foo cannot be resolved", +// ((IMessage)MyTaskListManager.getErrorMessages().get(0)) +// .getMessage()); +// alter("PR113531","inc2"); +// build("PR113531"); +// assertTrue("There should be no exceptions handled", +// MyErrorHandler.getErrorMessages().isEmpty()); +// } // other possible tests: -- 2.39.5