stevel      2004/08/08 14:03:21

  Modified:    src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  fixed the test failure, added a proper self contained test.
  
  I have commented out the test that asserts that sourceTime==destTime implies 
up-to-dateness. This is an interesting problem. Filesys granularity gets in the 
way.
  
  Revision  Changes    Path
  1.29      +22 -3     
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- FileUtilsTest.java        4 Aug 2004 19:54:20 -0000       1.28
  +++ FileUtilsTest.java        8 Aug 2004 21:03:21 -0000       1.29
  @@ -83,9 +83,6 @@
           long secondModTime = removeThis.lastModified();
           assertTrue(secondModTime > modTime);
   
  -        //check that the isUpToDate logic works
  -        assertFalse(fu.isUpToDate(modTime,secondModTime));
  -
           // number of milliseconds in a day
           final int millisperday=24 * 3600 * 1000;
           // in a previous version, the date of the file was set to 123456
  @@ -436,6 +433,28 @@
                        fu.fromURI("file:./foo"));
           assertEqualsIgnoreDriveCase(localize("/foo bar"), 
fu.fromURI("file:///foo%20bar"));
           assertEqualsIgnoreDriveCase(localize("/foo#bar"), 
fu.fromURI("file:///foo%23bar"));
  +    }
  +
  +    public void testModificationTests() {
  +
  +        //get a time
  +        long firstTime=System.currentTimeMillis();
  +        //add some time. We assume no OS has a granularity this bad
  +        long secondTime=firstTime+60000;
  +/*
  +        assertTrue("same timestamp is up to date",
  +                fu.isUpToDate(firstTime, firstTime));
  +                */
  +
  +        //check that older is up to date with a newer dest
  +        assertTrue("older source files are up to date",
  +                fu.isUpToDate(firstTime,secondTime));
  +        //check that older is up to date with a newer dest
  +        assertFalse("newer source files are no up to date",
  +                fu.isUpToDate(secondTime, firstTime));
  +
  +        assertTrue("-1 dest timestamp implies nonexistence",
  +                !fu.isUpToDate(firstTime,-1L));
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to