<?xml version="1.0"?>

<project basedir="." default="cleanup">

  <target name="cleanup">
    <delete file="asf-logo.gif" />
    <delete file="untartest.tar" />
    <delete dir="untartestin"/>
    <delete dir="untartestout"/>
  </target>

  <target name="testTarTask">
    <ant antfile="tar.xml" target="feather" />
    <untar src="asf-logo.gif.tar" dest="." />
    <ant antfile="tar.xml" target="cleanup" />
  </target>

  <target name="testGzipTarTask">
    <ant antfile="tar.xml" target="feather" />
    <untar src="asf-logo.gif.tar.gz" dest="." compression="gzip" />
    <ant antfile="tar.xml" target="cleanup" />
  </target>

  <target name="testBzip2TarTask">
    <ant antfile="tar.xml" target="feather" />
    <untar src="asf-logo.gif.tar.bz2" dest="." compression="bzip2"/>
    <ant antfile="tar.xml" target="cleanup" />
  </target>

  <target name="realTest">
    <untar src="expected/asf-logo.gif.tar" dest="." />
  </target>

  <target name="realGzipTest">
    <untar src="expected/asf-logo.gif.tar.gz" dest="." compression="gzip" />
  </target>

  <target name="realBzip2Test">
    <untar src="expected/asf-logo.gif.tar.bz2" dest="." compression="bzip2"/>
  </target>


  <target name="srcDirTest">
    <untar src="." dest="." />
  </target>

  <target name="encoding">
    <untar src="expected/asf-logo.gif.tar" dest="." encoding="foo"/>
  </target>

  <target name="resourceCollection">
    <mkdir dir="untartestout"/>
    <zip destfile="untartestout/test.zip">
      <fileset dir="expected">
        <include name="asf-logo.gif.tar"/>
      </fileset>
    </zip>
    <untar dest=".">
      <zipfileset src="untartestout/test.zip">
        <include name="*.tar"/>
      </zipfileset>
    </untar>
  </target>

  <target name="prepareTestTar">
    <mkdir dir="untartestin/1"/>
    <mkdir dir="untartestin/2"/>
    <touch file="untartestin/1/foo"/>
    <touch file="untartestin/2/bar"/>
    <copy todir="untartestin/2">
      <fileset dir="expected" includes="*md5*"/>
    </copy>
    <tar destfile="untartest.tar" basedir="untartestin"/>
  </target>

  <target name="testDocumentationClaimsOnCopy" depends="prepareTestTar">
    <copy todir="untartestout" preservelastmodified="true"> 
      <tarfileset src="untartest.tar">
        <patternset>
          <include name="2/"/>
        </patternset>
      </tarfileset>
    </copy>
  </target>
  
</project>
