From 7139ac48be452e260c39f5c75ed845b661725cc9 Mon Sep 17 00:00:00 2001 From: wisberg Date: Mon, 10 Mar 2003 22:47:43 +0000 Subject: [PATCH] harness tests upgraded to avoid tests that rely on multiple error messages and to add coverage for sourceroot tests --- tests/ajcHarnessTests.xml | 149 +++++++++--------- .../{ErrorWarning.java => WarningTest.java} | 8 +- .../sourceroot-inc/packageOne/Main.22.java | 19 +++ .../sourceroot-inc/packageOne/Main.java | 18 +++ tests/harness/sourceroot/packageOne/Main.java | 18 +++ tests/harness/sourceroot2/RequireMain.java | 12 ++ 6 files changed, 148 insertions(+), 76 deletions(-) rename tests/harness/{ErrorWarning.java => WarningTest.java} (70%) create mode 100644 tests/harness/sourceroot-inc/packageOne/Main.22.java create mode 100644 tests/harness/sourceroot-inc/packageOne/Main.java create mode 100644 tests/harness/sourceroot/packageOne/Main.java create mode 100644 tests/harness/sourceroot2/RequireMain.java diff --git a/tests/ajcHarnessTests.xml b/tests/ajcHarnessTests.xml index bc7a1b550..db330266f 100644 --- a/tests/ajcHarnessTests.xml +++ b/tests/ajcHarnessTests.xml @@ -6,20 +6,7 @@ with -logPass -ajctestRequireKeywords=expect-fail or with -logFail -ajctestSkipKeywords=expect-fail - hmm. not running suite if any test fails setup? - - - - - - - - - - + Also pick out "incremental" keyword for incremental tests. --> - - - + title="2 error"> + + + - - - - + + + + - - - - + + + + - - - + + - - - - - - - - + + + + - - - + + + + - - - - - + + + + - - - + + + - - - - - + + + - - - - - + + + - + + + + - - - - - - @@ -151,6 +133,29 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/harness/ErrorWarning.java b/tests/harness/WarningTest.java similarity index 70% rename from tests/harness/ErrorWarning.java rename to tests/harness/WarningTest.java index 0719f2993..e2c4fa84c 100644 --- a/tests/harness/ErrorWarning.java +++ b/tests/harness/WarningTest.java @@ -1,20 +1,20 @@ import org.aspectj.testing.Tester; -public class ErrorWarning { +public class WarningTest { public static void main (String[] args) { boolean passed = true; try { ok(); } catch (Error e) { passed = false; } Tester.check(passed, "did not catch error"); - } // end of main () + } public static void ok() { try { - throw new Error();; // CE 13 unless -lenient + throw new Error(); } catch(Error e) { } // CW 14 per aspect } static aspect A { - declare warning : withincode(void ErrorWarning.ok()) + declare warning : withincode(void WarningTest.ok()) && (handler(Error)) : "warning"; } } diff --git a/tests/harness/sourceroot-inc/packageOne/Main.22.java b/tests/harness/sourceroot-inc/packageOne/Main.22.java new file mode 100644 index 000000000..c6c768448 --- /dev/null +++ b/tests/harness/sourceroot-inc/packageOne/Main.22.java @@ -0,0 +1,19 @@ + +package packageOne; + +import org.aspectj.testing.Tester; + +public class Main { + public static void main(String[] args) { + Tester.expectEvent("go"); + for (int i = 0; i < args.length; i++) { + Tester.expectEvent(args[i]); + } + go(); + Tester.checkAllEvents(); + } + static void go() { + Tester.event("go"); + Tester.event("new-event"); // newly-generated event + } +} \ No newline at end of file diff --git a/tests/harness/sourceroot-inc/packageOne/Main.java b/tests/harness/sourceroot-inc/packageOne/Main.java new file mode 100644 index 000000000..c5204df12 --- /dev/null +++ b/tests/harness/sourceroot-inc/packageOne/Main.java @@ -0,0 +1,18 @@ + +package packageOne; + +import org.aspectj.testing.Tester; + +public class Main { + public static void main(String[] args) { + Tester.expectEvent("go"); + for (int i = 0; i < args.length; i++) { + Tester.expectEvent(args[i]); + } + go(); + Tester.checkAllEvents(); + } + static void go() { + Tester.event("go"); + } +} \ No newline at end of file diff --git a/tests/harness/sourceroot/packageOne/Main.java b/tests/harness/sourceroot/packageOne/Main.java new file mode 100644 index 000000000..c5204df12 --- /dev/null +++ b/tests/harness/sourceroot/packageOne/Main.java @@ -0,0 +1,18 @@ + +package packageOne; + +import org.aspectj.testing.Tester; + +public class Main { + public static void main(String[] args) { + Tester.expectEvent("go"); + for (int i = 0; i < args.length; i++) { + Tester.expectEvent(args[i]); + } + go(); + Tester.checkAllEvents(); + } + static void go() { + Tester.event("go"); + } +} \ No newline at end of file diff --git a/tests/harness/sourceroot2/RequireMain.java b/tests/harness/sourceroot2/RequireMain.java new file mode 100644 index 000000000..b1b8df7ae --- /dev/null +++ b/tests/harness/sourceroot2/RequireMain.java @@ -0,0 +1,12 @@ + +import org.aspectj.testing.Tester; + +/** Make Tester require execution of main method */ +public aspect RequireMain { + static { + Tester.expectEvent("RequireMain - main"); + } + before() : execution(static void main(String[])) { + Tester.event("RequireMain - main"); + } +} \ No newline at end of file -- 2.39.5