Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 74939 invoked from network); 8 Aug 2004 21:03:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Aug 2004 21:03:25 -0000 Received: (qmail 36396 invoked by uid 500); 8 Aug 2004 21:03:23 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 36327 invoked by uid 500); 8 Aug 2004 21:03:22 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 36314 invoked by uid 500); 8 Aug 2004 21:03:22 -0000 Received: (qmail 36311 invoked by uid 99); 8 Aug 2004 21:03:22 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Sun, 08 Aug 2004 14:03:22 -0700 Received: (qmail 74932 invoked by uid 1365); 8 Aug 2004 21:03:21 -0000 Date: 8 Aug 2004 21:03:21 -0000 Message-ID: <20040808210321.74931.qmail@minotaur.apache.org> From: stevel@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org