blob: ec340b4d54eef3713e3f85f10773961afb6b95cc [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="dependset-test" xmlns:au="antlib:org.apache.ant.antunit">
<target name="test1">
<au:expectfailure expectedMessage="At least one set of source resources must be specified">
<dependset />
</au:expectfailure>
</target>
<target name="test2">
<au:expectfailure expectedMessage="At least one set of target files must be specified">
<dependset>
<srcfilelist dir="." files="test2.tmp" />
</dependset>
</au:expectfailure>
</target>
<target name="test3">
<au:expectfailure expectedMessage="At least one set of source resources must be specified">
<dependset>
<targetfileset dir="." includes="test3.tmp" />
</dependset>
</au:expectfailure>
</target>
<target name="test4">
<touch file="test4.tmp" />
<dependset>
<srcfilelist dir="." files="test4.tmp" />
<targetfileset id="targetfs" dir="." includes="i-do-not-exist" />
</dependset>
</target>
<target name="test5">
<touch file="older.tmp" />
<sleep seconds="3" />
<touch file="newer.tmp" />
<dependset>
<srcfilelist dir="." files="newer.tmp" />
<targetfilelist dir="." files="older.tmp" />
</dependset>
<au:assertFalse>
<available file="older.tmp" />
</au:assertFalse>
</target>
<target name="test6">
<touch file="sourceset_1.tmp" />
<touch file="targetset_1.tmp" />
<sleep seconds="3" />
<touch file="sourceset_2.tmp" />
<touch file="targetset_2.tmp" />
<sleep seconds="2" />
<dependset>
<sources>
<filelist dir="." files="sourceset_1.tmp,sourceset_2.tmp" />
</sources>
<targets>
<filelist dir="." files="targetset_1.tmp,targetset_2.tmp" />
</targets>
</dependset>
<au:assertFalse>
<available file="targetset_1.tmp" />
</au:assertFalse>
<au:assertFalse>
<available file="targetset_2.tmp" />
</au:assertFalse>
</target>
<target name="test7">
<touch file="older.tmp" />
<dependset>
<sources>
<propertyresource name="thereisnosuchproperty" />
</sources>
<targets>
<filelist dir="." files="older.tmp" />
</targets>
</dependset>
<au:assertFalse>
<available file="older.tmp" />
</au:assertFalse>
</target>
<target name="test8">
<touch file="older.tmp" />
<property name="foo" value="bar" />
<dependset>
<sources>
<propertyresource name="foo" />
</sources>
<targets>
<filelist dir="." files="older.tmp" />
</targets>
</dependset>
<au:assertTrue>
<available file="older.tmp" />
</au:assertTrue>
</target>
<target name="test9">
<au:assertFalse>
<available file="test9dir" type="dir" />
</au:assertFalse>
<touch file="test9.tmp" />
<dependset>
<srcfileset dir="." includes="test9.tmp" />
<targetfileset dir="test9dir" />
</dependset>
</target>
<target name="tearDown">
<delete file="test4.tmp" />
<delete file="test9.tmp" />
<delete file="older.tmp" />
<delete file="newer.tmp" />
<delete file="sourceset_1.tmp" />
<delete file="sourceset_2.tmp" />
<delete file="targetset_1.tmp" />
<delete file="targetset_2.tmp" />
</target>
</project>