Browse Source

ws; [delete, touch] => truncate

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@537871 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
d6bcb1600b
1 changed files with 14 additions and 15 deletions
  1. +14
    -15
      src/tests/antunit/taskdefs/condition/resourcecontains-test.xml

+ 14
- 15
src/tests/antunit/taskdefs/condition/resourcecontains-test.xml View File

@@ -5,31 +5,30 @@
<target name="setUp">
<property name="file" location="${java.io.tmpdir}/test-resource.txt"/>
<echo file="${file}" message="loads of text!"/>
<echo file="${file}" message="loads of text!"/>
</target>
<target name="tearDown">
<delete file="${file}"/>
</target>
<target name="testcontains">
<au:assertFileExists file="${file}"/>
<au:assertTrue message="Should have found the text in the resource">
<resourcecontains resource="${file}" substring="text"/>
</au:assertTrue>
<au:assertFileExists file="${file}"/>
<au:assertTrue message="Should have found the text in the resource">
<resourcecontains resource="${file}" substring="text"/>
</au:assertTrue>
</target>
<target name="testwithemptyfile">
<delete file="${file}"/>
<touch file="${file}"/>
<au:assertFalse message="Should have found nothing as file is empty">
<truncate file="${file}"/>
<au:assertFalse message="Should have found nothing as file is empty">
<resourcecontains resource="${file}" substring="text"/>
</au:assertFalse>
</au:assertFalse>
</target>
<target name="testdoesntcontain">
<au:assertFalse message="Should have found nothing as file is empty">
<resourcecontains resource="${file}" substring="futurama"/>
<au:assertFalse message="Should have found nothing as file is empty">
<resourcecontains resource="${file}" substring="futurama"/>
</au:assertFalse>
</target>
</project>
</project>

Loading…
Cancel
Save