ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/depend DependTest.java
Date Mon, 08 Apr 2002 06:56:41 GMT
conor       02/04/07 23:56:41

  Modified:    src/etc/testcases/taskdefs/optional/depend depend.xml
               src/testcases/org/apache/tools/ant/taskdefs/optional/depend
                        DependTest.java
  Added:       src/etc/testcases/taskdefs/optional/depend/src2 A.java
                        B.java
               src/etc/testcases/taskdefs/optional/depend/src3 A.java
                        B.java
  Log:
  New depend checks
  
  Revision  Changes    Path
  1.5       +36 -7     jakarta-ant/src/etc/testcases/taskdefs/optional/depend/depend.xml
  
  Index: depend.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/optional/depend/depend.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -u -r1.4 -r1.5
  --- depend.xml	8 Apr 2002 05:10:31 -0000	1.4
  +++ depend.xml	8 Apr 2002 06:56:41 -0000	1.5
  @@ -2,6 +2,8 @@
   
   <project name="depend" basedir="." default="help">
     <property name="src1.dir" value="src1"/>
  +  <property name="src2.dir" value="src2"/>
  +  <property name="src3.dir" value="src3"/>
     <property name="tempsrc.dir" value="working"/>
     <property name="classes.dir" value="classes"/>
     <target name="help">
  @@ -18,7 +20,19 @@
       </copy>
     </target>
     
  -  <target name="src1compile" depends="src1setup">
  +  <target name="src2setup" depends="basesetup">
  +    <copy todir="${tempsrc.dir}">
  +      <fileset dir="${src2.dir}"/>
  +    </copy>
  +  </target>
  +
  +  <target name="src3setup" depends="basesetup">
  +    <copy todir="${tempsrc.dir}">
  +      <fileset dir="${src3.dir}"/>
  +    </copy>
  +  </target>
  +
  +  <target name="compile">
       <mkdir dir="${classes.dir}"/>
       <javac srcdir="${tempsrc.dir}" destdir="${classes.dir}"/>
     </target>
  @@ -28,7 +42,7 @@
       <delete dir="${tempsrc.dir}"/>
     </target>
   
  -  <target name="testdirect" depends="src1compile">
  +  <target name="testdirect" depends="src1setup, compile">
       <sleep seconds="3"/>
       <delete file="${tempsrc.dir}/C.java"/>
       <copy file="${src1.dir}/C.java" tofile="${tempsrc.dir}/C.java"/>
  @@ -36,7 +50,7 @@
       <fileset id="result" dir="${classes.dir}"/>
     </target>
   
  -  <target name="testclosure" depends="src1compile">
  +  <target name="testclosure" depends="src1setup, compile">
       <sleep seconds="3"/>
       <delete file="${tempsrc.dir}/C.java"/>
       <copy file="${src1.dir}/C.java" tofile="${tempsrc.dir}/C.java"/>
  @@ -44,21 +58,21 @@
       <fileset id="result" dir="${classes.dir}"/>
     </target>
   
  -  <target name="testbasicset" depends="src1compile">
  +  <target name="testbasicset" depends="src1setup, compile">
       <classfileset id="result" dir="${classes.dir}" rootclass="A"/>
     </target>
   
  -  <target name="testsmallset" depends="src1compile">
  +  <target name="testsmallset" depends="src1setup, compile">
       <classfileset id="result" dir="${classes.dir}" rootclass="B"/>
     </target>
   
  -  <target name="testcomboset" depends="src1compile">
  +  <target name="testcomboset" depends="src1setup, compile">
       <classfileset id="result" dir="${classes.dir}" rootclass="B">
         <include name="**/C.class"/>
       </classfileset>
     </target>
     
  -  <target name="testbyreference" depends="src1compile">
  +  <target name="testbyreference" depends="src1setup, compile">
       <classfileset id="classSet" dir="${classes.dir}" rootclass="A">
         <include name="**/C.class"/>
       </classfileset>
  @@ -67,4 +81,19 @@
       </jar>
     </target>
     
  +  <target name="testinner" depends="src2setup, compile">
  +    <sleep seconds="3"/>
  +    <delete file="${tempsrc.dir}/B.java"/>
  +    <copy file="${src2.dir}/B.java" tofile="${tempsrc.dir}/B.java"/>
  +    <depend srcdir="${tempsrc.dir}" destdir="${classes.dir}" closure="yes"/>
  +    <fileset id="result" dir="${classes.dir}"/>
  +  </target>
  +
  +  <target name="testinnerinner" depends="src3setup, compile">
  +    <sleep seconds="3"/>
  +    <delete file="${tempsrc.dir}/B.java"/>
  +    <copy file="${src3.dir}/B.java" tofile="${tempsrc.dir}/B.java"/>
  +    <depend srcdir="${tempsrc.dir}" destdir="${classes.dir}" closure="yes"/>
  +    <fileset id="result" dir="${classes.dir}"/>
  +  </target>
   </project>
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/depend/src2/A.java
  
  Index: A.java
  ===================================================================
  public class A {
      static private class Inner extends B {
      }
  }
  
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/depend/src2/B.java
  
  Index: B.java
  ===================================================================
  public class B {
  }
  
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/depend/src3/A.java
  
  Index: A.java
  ===================================================================
  public class A {
      static private class Inner {
          static private class Inner2 extends B {
          }
      }
  }
  
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/depend/src3/B.java
  
  Index: B.java
  ===================================================================
  public class B {
  }
  
  
  
  
  1.2       +35 -0     jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
  
  Index: DependTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -u -r1.1 -r1.2
  --- DependTest.java	4 Apr 2002 13:55:59 -0000	1.1
  +++ DependTest.java	8 Apr 2002 06:56:41 -0000	1.2
  @@ -125,4 +125,39 @@
           assertTrue("Result did not contain D.class", 
               files.containsKey("D.class"));
       }
  +
  +    /**
  +     * Test that inner class dependencies trigger deletion of the outer class
  +     */
  +    public void testInner() {
  +        Project project = getProject();
  +        executeTarget("testinner");
  +        FileSet resultFileSet = (FileSet)project.getReference(RESULT_FILESET);
  +        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(project);
  +        String[] scannedFiles = scanner.getIncludedFiles();
  +        Hashtable files = new Hashtable();
  +        for (int i = 0; i < scannedFiles.length; ++i) {
  +            files.put(scannedFiles[i], scannedFiles[i]);
  +        }
  +        assertEquals("Depend did not leave correct number of files", 0, 
  +            files.size());
  +    }
  +
  +    /**
  +     * Test that multi-leve inner class dependencies trigger deletion of 
  +     * the outer class
  +     */
  +    public void testInnerInner() {
  +        Project project = getProject();
  +        executeTarget("testinnerinner");
  +        FileSet resultFileSet = (FileSet)project.getReference(RESULT_FILESET);
  +        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(project);
  +        String[] scannedFiles = scanner.getIncludedFiles();
  +        Hashtable files = new Hashtable();
  +        for (int i = 0; i < scannedFiles.length; ++i) {
  +            files.put(scannedFiles[i], scannedFiles[i]);
  +        }
  +        assertEquals("Depend did not leave correct number of files", 0, 
  +            files.size());
  +    }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message