ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: ant/src/etc/testcases/core directoryscanner.xml
Date Mon, 28 Jul 2003 22:07:48 GMT
antoine     2003/07/28 15:07:47

  Modified:    src/testcases/org/apache/tools/ant DirectoryScannerTest.java
               src/etc/testcases/core directoryscanner.xml
  Log:
  changed the implementation of testChildrenOfExcludedDirectory
  to use the new test bed system
  
  Revision  Changes    Path
  1.22      +14 -29    ant/src/testcases/org/apache/tools/ant/DirectoryScannerTest.java
  
  Index: DirectoryScannerTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/DirectoryScannerTest.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DirectoryScannerTest.java	23 Jul 2003 07:30:13 -0000	1.21
  +++ DirectoryScannerTest.java	28 Jul 2003 22:07:47 -0000	1.22
  @@ -351,40 +351,25 @@
        * Test inspired by Bug#1415.
        */
       public void testChildrenOfExcludedDirectory() {
  -        File dir = new File("src/main/org/apache/tools");
  +        getProject().executeTarget("children-of-excluded-dir-setup");
           DirectoryScanner ds = new DirectoryScanner();
  -        ds.setBasedir(dir);
  -        ds.setExcludes(new String[] {"ant/**"});
  +        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
  +        ds.setExcludes(new String[] {"alpha/**"});
  +        ds.setFollowSymlinks(false);
           ds.scan();
  -
  -        boolean haveZipPackage = false;
  -        boolean haveTaskdefsPackage = false;
  -        String[] included = ds.getIncludedDirectories();
  -        for (int i=0; i<included.length; i++) {
  -            if (included[i].equals("zip")) {
  -                haveZipPackage = true;
  -            } else if (included[i].equals("ant"+File.separator+"taskdefs")) {
  -                haveTaskdefsPackage = true;
  -            }
  -        }
  -        assertTrue("(1) zip package included", haveZipPackage);
  -        assertTrue("(1) taskdefs package not included", !haveTaskdefsPackage);
  +        compareFiles(ds, new String[] {"delta/delta.xml"},
  +                    new String[] {"", "delta"});
   
           ds = new DirectoryScanner();
  -        ds.setBasedir(dir);
  -        ds.setExcludes(new String[] {"ant"});
  +        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
  +        ds.setExcludes(new String[] {"alpha"});
  +        ds.setFollowSymlinks(false);
           ds.scan();
  -        haveZipPackage = false;
  -        included = ds.getIncludedDirectories();
  -        for (int i=0; i<included.length; i++) {
  -            if (included[i].equals("zip")) {
  -                haveZipPackage = true;
  -            } else if (included[i].equals("ant"+File.separator+"taskdefs")) {
  -                haveTaskdefsPackage = true;
  -            }
  -        }
  -        assertTrue("(2) zip package included", haveZipPackage);
  -        assertTrue("(2) taskdefs package included", haveTaskdefsPackage);
  +        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
  +                                       "alpha/beta/gamma/gamma.xml",
  +                                        "delta/delta.xml"},
  +                     new String[] {"", "alpha/beta", "alpha/beta/gamma", "delta"});
  +
       }
   
       private void compareFiles(DirectoryScanner ds, String[] expectedFiles, 
  
  
  
  1.3       +4 -0      ant/src/etc/testcases/core/directoryscanner.xml
  
  Index: directoryscanner.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/core/directoryscanner.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- directoryscanner.xml	16 Jul 2003 13:34:14 -0000	1.2
  +++ directoryscanner.xml	28 Jul 2003 22:07:47 -0000	1.3
  @@ -5,6 +5,10 @@
           <touch file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/>
           <touch file="${tmp.dir}/alpha/beta/beta.xml"/>
       </target>
  +    <target name="children-of-excluded-dir-setup" depends="setup">
  +        <mkdir dir="${tmp.dir}/delta"/>
  +        <touch file="${tmp.dir}/delta/delta.xml"/>
  +    </target>
       <target name="cleanup">
           <delete dir="${tmp.dir}" quiet="true"/>
       </target>
  
  
  

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


Mime
View raw message