]> source.dussan.org Git - aspectj.git/commitdiff
harness tests upgraded to avoid tests that rely on multiple error messages
authorwisberg <wisberg>
Mon, 10 Mar 2003 22:47:43 +0000 (22:47 +0000)
committerwisberg <wisberg>
Mon, 10 Mar 2003 22:47:43 +0000 (22:47 +0000)
and to add coverage for sourceroot tests

tests/ajcHarnessTests.xml
tests/harness/ErrorWarning.java [deleted file]
tests/harness/WarningTest.java [new file with mode: 0644]
tests/harness/sourceroot-inc/packageOne/Main.22.java [new file with mode: 0644]
tests/harness/sourceroot-inc/packageOne/Main.java [new file with mode: 0644]
tests/harness/sourceroot/packageOne/Main.java [new file with mode: 0644]
tests/harness/sourceroot2/RequireMain.java [new file with mode: 0644]

index bc7a1b550e7781df3d5d9cae98dc8b4e77fab7ea..db330266f9e19b552b45c46f779141dd2dc1a028 100644 (file)
@@ -6,20 +6,7 @@
         with -logPass -ajctestRequireKeywords=expect-fail
      or with -logFail -ajctestSkipKeywords=expect-fail
 
-    hmm.  not running suite if any test fails setup?
-    
-    <ajc-test dir="new" title="bad arguments passed to ajc"
-     keywords="expect-fail">
-        <compile files="TestTester.java"/>
-        <run class="TestTester"/>
-    </ajc-test>
-
-    <ajc-test dir="new"
-      title="no such file - report as error (CompilerRun specification)"
-     keywords="expect-fail">
-        <compile files="NoSuchFile.java"/>
-    </ajc-test>
-
+     Also pick out "incremental" keyword for incremental tests.
 -->
 <suite>
     <ajc-test dir="noSuchDir"
     </ajc-test>
 
     <ajc-test dir="harness"
-      title="1 error and 1 warning, with warning line wrong"
-     keywords="expect-fail">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="13" />
-            <message kind="warning" line="15"  text="Wrong line number"/>
+      title="2 error">
+        <compile files="ErrorTest.java">
+            <message kind="error" line="5"/>
+            <message kind="error" line="6"/>
         </compile>
     </ajc-test>
 
-    <ajc-test dir="harness" title="1 error and 1 warning, with error line wrong"
-     keywords="expect-fail">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="12"  text="Wrong line number"/>
-            <message kind="warning" line="14"/>
+    <ajc-test dir="harness"
+      title="2 error, with filenames">
+        <compile files="ErrorTest.java">
+            <message kind="error" line="5" file="ErrorTest.java"/>
+            <message kind="error" line="6" file="ErrorTest.java"/>
         </compile>
     </ajc-test>
 
-    <ajc-test dir="harness" title="1 error and 1 warning, with both lines wrong"
+    <ajc-test dir="harness"
+      title="2 error, three expected"
      keywords="expect-fail">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="12"  text="Wrong error line"/>
-            <message kind="warning" line="15"  text="Wrong warning line"/>
+        <compile files="ErrorTest.java">
+            <message kind="error" line="5"/>
+            <message kind="error" line="6"/>
+            <message kind="error" line="8"/>
         </compile>
     </ajc-test>
 
     <ajc-test dir="harness"
-      title="expecting error, get warning"
+      title="2 error, one unexpected"
      keywords="expect-fail">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="13"/>
-            <message kind="error" line="14" text="error line"/>
+        <compile files="ErrorTest.java">
+            <message kind="error" line="6"/>
         </compile>
     </ajc-test>
 
     <ajc-test dir="harness"
-      title="1 error and 1 warning, failed to specify expected warning "
-     keywords="expect-fail"
-     comment="unexpected pass b/c 1.1 bug: declare fails to warn">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="13"/>
-        </compile>
-    </ajc-test>
-
-    <ajc-test dir="harness" title="checks and events, failed to specify 6 expected fails"
+      title="2 error, one with with error line wrong"
      keywords="expect-fail">
-        <compile files="TestTesterFail.java"/>
-        <run class="TestTesterFail"/>
+        <compile files="ErrorTest.java">
+            <message kind="error" line="5"/>
+            <message kind="error" line="7" text="Wrong line number"/>
+        </compile>
     </ajc-test>
 
-    <ajc-test dir="harness" title="one missing note"
+    <ajc-test dir="harness"
+      title="2 error, one with with kind wrong"
      keywords="expect-fail">
-        <compile files="TesterNotesFail.java"/>
-        <run class="TesterNotesFail"/>
+        <compile files="ErrorTest.java">
+            <message kind="error" line="5"/>
+            <message kind="warning" line="6"/>
+        </compile>
     </ajc-test>
-
-    <ajc-test dir="harness" title="1 error and 1 warning, with filenames">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="13"  file="ErrorWarning.java"/>
-            <message kind="warning" line="14"  file="ErrorWarning.java"/>
+    
+    <ajc-test dir="harness"
+      title="1 warning">
+        <compile files="WarningTest.java">
+            <message kind="warning" line="14"/>
         </compile>
     </ajc-test>
-
-    <ajc-test dir="harness" title="messages treated as errors">
-        <compile files="Messages.java">
+    
+    <ajc-test dir="harness"
+      title="1 warning with kind wrong"
+     keywords="expect-fail">
+        <compile files="WarningTest.java">
             <message kind="error" line="14"/>
-            <message kind="error" line="15"/>
         </compile>
     </ajc-test>
 
-    <ajc-test dir="harness" title="1 error and 1 warning, without filename">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="13"/>
-            <message kind="warning" line="14"/>
+    <ajc-test dir="harness"
+      title="1 warning with line wrong"
+     keywords="expect-fail">
+        <compile files="WarningTest.java">
+            <message kind="warning" line="15"/>
         </compile>
     </ajc-test>
 
-    <ajc-test dir="harness" title="1 error and 1 warning, with filename">
-        <compile files="ErrorWarning.java">
-            <message kind="error" line="13" file="ErrorWarning.java"/>
-            <message kind="warning" line="14" file="ErrorWarning.java"/>
-        </compile>
+    <ajc-test dir="harness" title="checks and events, failed to specify 6 expected fails"
+     keywords="expect-fail">
+        <compile files="TestTesterFail.java"/>
+        <run class="TestTesterFail"/>
     </ajc-test>
 
-
+    <ajc-test dir="harness" title="one missing note"
+     keywords="expect-fail">
+        <compile files="TesterNotesFail.java"/>
+        <run class="TesterNotesFail"/>
+    </ajc-test>
 
     <ajc-test dir="harness" title="checks and events, all should pass">
         <compile files="TestTester.java"/>
         <run class="TestTester"/>
     </ajc-test>
 
-       <!-- XXX need keywords for running in eclipse or from the command-line -->
-    <ajc-test dir="harness" title="checks and events, expect error without tester (when run outside eclipse)"
-      keywords="expect-fail" >
-        <compile files="TestTester.java"/>
-        <run class="TestTester" skipTester="true"/>
-    </ajc-test>
-
     <ajc-test dir="harness" title="event files">
         <compile files="TestTesterFile.java"/>
         <run class="TestTesterFile"/>
         <run class="AspectMain"/>
     </ajc-test>
 
+       <!-- testing incremental support -->
+    <ajc-test dir="harness"  keywords="incremental"
+               title="minimal purejava sourceroots test">
+        <compile sourceroots="sourceroot"/>
+               <run class="packageOne.Main"/>
+    </ajc-test>
+
+    <ajc-test dir="harness"  keywords="incremental"
+               title="test of dual sourceroots with aspects">
+        <compile sourceroots="sourceroot,sourceroot2"/>
+               <run class="packageOne.Main"/>
+    </ajc-test>
+
+    <ajc-test dir="harness"  keywords="incremental"
+               title="minimal incremental purejava sourceroots test">
+        <compile options="-incremental" 
+               sourceroots="sourceroot-inc"/>
+               <run class="packageOne.Main"/>
+        <inc-compile tag="22"/> <!-- generates new-event -->
+               <run class="packageOne.Main" 
+                  options="new-event"/> <!-- now expect new-event -->
+    </ajc-test>
+
 </suite>
 
 
diff --git a/tests/harness/ErrorWarning.java b/tests/harness/ErrorWarning.java
deleted file mode 100644 (file)
index 0719f29..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-import org.aspectj.testing.Tester;
-
-public class ErrorWarning {
-    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
-        } catch(Error e) { }      // CW 14 per aspect
-    }
-    static aspect A {
-        declare warning : withincode(void ErrorWarning.ok())
-            && (handler(Error)) : "warning";
-    }
-}
-
-
diff --git a/tests/harness/WarningTest.java b/tests/harness/WarningTest.java
new file mode 100644 (file)
index 0000000..e2c4fa8
--- /dev/null
@@ -0,0 +1,22 @@
+import org.aspectj.testing.Tester;
+
+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");
+    } 
+    
+    public static void ok() {
+        try {
+            throw new Error();
+        } catch(Error e) { }      // CW 14 per aspect
+    }
+    static aspect A {
+        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 (file)
index 0000000..c6c7684
--- /dev/null
@@ -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 (file)
index 0000000..c5204df
--- /dev/null
@@ -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 (file)
index 0000000..c5204df
--- /dev/null
@@ -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 (file)
index 0000000..b1b8df7
--- /dev/null
@@ -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