You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

resourcecontains-test.xml 1.2 kB

1234567891011121314151617181920212223242526272829303132333435
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <project name="resourcecontains-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
  3. <import file="../../antunit-base.xml"/>
  4. <target name="setUp">
  5. <property name="file" location="${java.io.tmpdir}/test-resource.txt"/>
  6. <echo file="${file}" message="loads of text!"/>
  7. </target>
  8. <target name="tearDown">
  9. <delete file="${file}"/>
  10. </target>
  11. <target name="testcontains">
  12. <au:assertFileExists file="${file}"/>
  13. <au:assertTrue message="Should have found the text in the resource">
  14. <resourcecontains resource="${file}" substring="text"/>
  15. </au:assertTrue>
  16. </target>
  17. <target name="testwithemptyfile">
  18. <delete file="${file}"/>
  19. <touch file="${file}"/>
  20. <au:assertFalse message="Should have found nothing as file is empty">
  21. <resourcecontains resource="${file}" substring="text"/>
  22. </au:assertFalse>
  23. </target>
  24. <target name="testdoesntcontain">
  25. <au:assertFalse message="Should have found nothing as file is empty">
  26. <resourcecontains resource="${file}" substring="futurama"/>
  27. </au:assertFalse>
  28. </target>
  29. </project>