<project name="testproject" default="def" basedir=".">

  <target name="def">
    <fail>This build-file is intended to be run from the test cases</fail>
  </target>

  <target name="simple">
    <scriptdef name="scripttest" language="javascript">
      <attribute name="attr1"/>
      <element name="fileset" type="fileset"/>
      <![CDATA[
        
        project.log("Attribute attr1 = " + attributes.get("attr1"));
        project.log("Fileset basedir = "
          + elements.get("fileset").get(0).getDir(project));
        
      ]]>
    </scriptdef>
    
    <fileset id="testfileset" dir="."/>
    <scripttest attr1="test">
      <fileset refid="testfileset"/>
    </scripttest>
  </target>

  <target name="nolang">
    <scriptdef name="nolang">
      <![CDATA[
        java.lang.System.out.println("Hello");
      ]]>
    </scriptdef>
  </target>

  <target name="noname">
    <scriptdef language="javascript">
      <![CDATA[
        java.lang.System.out.println("Hello");
      ]]>
    </scriptdef>
  </target>

  <target name="nestedbyclassname">
    <scriptdef name="scripttest" language="javascript">
      <attribute name="attr1"/>
      <element name="fileset" classname="org.apache.tools.ant.types.FileSet"/>
      <![CDATA[
        
        project.log("Attribute attr1 = " + attributes.get("attr1"));
        project.log("Fileset basedir = "
          + elements.get("fileset").get(0).getDir(project));
        
      ]]>
    </scriptdef>
    
    <fileset id="testfileset" dir="."/>
    <scripttest attr1="test">
      <fileset refid="testfileset"/>
    </scripttest>
  </target>
  
  <target name="noelement">
    <scriptdef name="scripttest" language="javascript">
      <attribute name="attr1"/>
      <element name="fileset" type="fileset"/>
      <![CDATA[
        java.lang.System.out.println("Attribute attr1 = " + attributes.get("attr1"));
      ]]>
    </scriptdef>
    
    <scripttest attr1="test">
    </scripttest>
  </target>

  <target name="exception">
    <scriptdef name="scripttest" language="javascript">
      <attribute name="attr1"/>
      <element name="fileset" classname="org.apache.tools.ant.types.FileSet"/>
      <![CDATA[
        
        java.lang.System.out.println("Attribute attr1 = " + attributes.get("attr1"));
        java.lang.System.out.println("Fileset basedir = "
          + elements.get("fileset").get(0).getDir(project));
        
      ]]>
    </scriptdef>
    
    <scripttest attr1="test">
    </scripttest>
  </target>
  
  <target name="doubledef">
    <scriptdef name="task1" language="javascript">
      <![CDATA[
        project.log("Task1");
      ]]>
    </scriptdef>
    <scriptdef name="task2" language="javascript">
      <![CDATA[
        project.log("Task2");
      ]]>
    </scriptdef>
    <task1/>
    <task2/>
  </target>
  
  <target name="doubleAttributeDef">
    <scriptdef name="scripttest" language="javascript">
      <attribute name="attr1"/>
      <attribute name="attr1"/>
    </scriptdef>
  </target>
  
  <target name="property">
    <scriptdef name="scripttest" language="javascript">
      <attribute name="attr1"/>
      <![CDATA[
        
        project.log("Attribute value = " + attributes.get("attr1"));
      ]]>
    </scriptdef>

    <property name="testproperty" value="test"/>    
    <scripttest attr1="${testproperty}">
    </scripttest>
  </target>


</project>
