]> source.dussan.org Git - aspectj.git/commitdiff
moved a command-line-driven test of classpath variants here
authorwisberg <wisberg>
Sat, 24 May 2003 12:25:34 +0000 (12:25 +0000)
committerwisberg <wisberg>
Sat, 24 May 2003 12:25:34 +0000 (12:25 +0000)
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java

index 51897d3ca17251c1f2bc39f567cc56fa25f4030b..89acd8d8f89c717c9259a167840ff3fa4e410c74 100644 (file)
@@ -69,7 +69,47 @@ public class AjcTaskTest extends TestCase {
         }
     }
     
-    private static void deleteTempDir() {
+    /** 
+      * Check that aspectjtools are found on the classpath,
+      * reporting any errors to System.err.
+      * 
+      * Run multiple times with different classpaths.
+      * This should find variants
+      * aspectjtools.jar,
+      * aspectj-tools.jar,
+      * aspectj-tools-1.1.jar, and
+      * aspectjtools-1.0.6.jar
+      * but not
+      * aspectjrt.jar or
+      * aspectj/tools.jar.
+      * XXX use testing aspect to stub out 
+      * <code>System.getProperty("java.class.path")</code>
+      * @param args a String[], first is expected path, if any
+      */
+     public static void main(String[] args) {
+         java.io.File toolsjar = AjcTask.findAspectjtoolsJar();
+         if ((null == args) || (0 == args.length)) {
+             if (null != toolsjar) {
+                 System.err.println("FAIL - not expected: " + toolsjar);
+             }
+         } else if ("-help".equals(args[0])) {
+             System.out.println("java " + AjcTaskTest.class.getName()
+                   + " <expectedPathToAspectjtoolsJar>");
+         } else if (null == toolsjar) {
+             System.err.println("FAIL - expected: " + args[0]);
+         } else {
+             String path = toolsjar.getAbsolutePath();
+             if (!path.equals(args[0])) {
+                 System.err.println("FAIL - expected: "
+                     + args[0]
+                     + " actual: "
+                     + path
+                     );
+             }
+         }
+     }
+     
+     private static void deleteTempDir() {
         if ((null != tempDir) && tempDir.exists()) {
             FileUtil.deleteContents(tempDir);
             tempDir.delete();