ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <anto...@antbuild.com>
Subject Re: cvs commit: ant/src/testcases/org/apache/tools/ant DirectoryScannerTest.java
Date Wed, 16 Jul 2003 11:24:21 GMT
Concerning the case insensitive scanning :

- As a very short term fix, one can bypass the checkIncludePatterns routine
and call scandir(basedir, "", true) in the case of case insensitive
scanning.

- The other possibility is to write (for instance in FileUtils) a routine of
the type
public static File findFileCaseInsensitive(File basedir, String child)
which internally would try all uppercase/lowercase combinations of child and
return null if the file cannot be found, or otherwise the sought file.

Would this be OK ?

Antoine
----- Original Message -----
From: <bodewig@apache.org>
To: <ant-cvs@apache.org>
Sent: Wednesday, July 16, 2003 1:09 PM
Subject: cvs commit: ant/src/testcases/org/apache/tools/ant
DirectoryScannerTest.java


> bodewig     2003/07/16 04:09:22
>
>   Modified:    src/testcases/org/apache/tools/ant
DirectoryScannerTest.java
>   Log:
>   Add tests for case insensitive matching.
>
>   Both tests with CaseInsensitive in their name fail on Linux, I expect
>   test2ButCaseInsesitive to pass on case insensitive file systems.
>
>   Will be either fixed or disabled shortly.
>
>   Revision  Changes    Path
>   1.14      +29 -0
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.13
>   retrieving revision 1.14
>   diff -u -r1.13 -r1.14
>   --- DirectoryScannerTest.java 16 Jul 2003 10:57:56 -0000 1.13
>   +++ DirectoryScannerTest.java 16 Jul 2003 11:09:19 -0000 1.14
>   @@ -115,6 +115,35 @@
>                                       "alpha/beta/gamma"});
>        }
>
>   +    public void testFullPathMatchesCaseSensitive() {
>   +        DirectoryScanner ds = new DirectoryScanner();
>   +        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
>   +        ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
>   +        ds.scan();
>   +        compareFiles(ds, new String[] {}, new String[] {});
>   +    }
>   +
>   +    public void testFullPathMatchesCaseInsensitive() {
>   +        DirectoryScanner ds = new DirectoryScanner();
>   +        ds.setCaseSensitive(false);
>   +        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
>   +        ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
>   +        ds.scan();
>   +        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
>   +                     new String[] {});
>   +    }
>   +
>   +    public void test2ButCaseInsesitive() {
>   +        DirectoryScanner ds = new DirectoryScanner();
>   +        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
>   +        ds.setIncludes(new String[] {"ALPHA/"});
>   +        ds.setCaseSensitive(false);
>   +        ds.scan();
>   +        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
>   +                                       "alpha/beta/gamma/gamma.xml"},
>   +                     new String[] {"alpha", "alpha/beta",
"alpha/beta/gamma"});
>   +    }
>   +
>        // father and child pattern test
>        public void testOrderOfIncludePatternsIrrelevant() {
>            String [] expectedFiles = {"alpha/beta/beta.xml",
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>



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


Mime
View raw message