<project name="testscriptcondition" >


  <macrodef name="t">
    <element name="test" implicit="yes" />
    <attribute name="message"/>
    <sequential>
      <fail message="query @{message} failed; result was false">
        <condition>
          <not>
            <test />
          </not>
        </condition>
      </fail>
    </sequential>
  </macrodef>  

  <macrodef name="f">
    <element name="test" implicit="yes" />
    <attribute name="message"/>
    <sequential>
      <fail message="test @{message} failed; result was true">
        <condition>
          <test/>
        </condition>
      </fail>
    </sequential>
  </macrodef>  
  
  <!-- this is here to test the macro is well coded -->
 <target name="testMacro">
    <t message="testMacro" >
        <istrue value="true"/>
    </t>
    <f message="testMacro2" >
        <istrue value="false"/>
    </f>
  </target>  

 <target name="testNolanguage">
    <t message="testNolanguage" >
      <scriptcondition >
        self.setValue(true);
      </scriptcondition>
    </t>
  </target>

  <target name="testClearByDefault">
    <f message="testClearByDefault" >
      <scriptcondition language="javascript">
      </scriptcondition>
    </f>
  </target>  
  
  <target name="testValueWorks">
    <t message="testValueWorks" >
      <scriptcondition language="javascript"
        value="true" />
    </t>
  </target>    
  
  <target name="testSetWorks">
    <t message="testSetWorks" >
      <scriptcondition language="javascript" value="false">
        self.setValue(true);
      </scriptcondition>
    </t>
  </target>

  <target name="testClearWorks">
    <f message="testClearWorks">
      <scriptcondition language="javascript" value="true">
        self.setValue(false);
      </scriptcondition>
    </f>
  </target>  
</project>
