Created
December 5, 2012 21:45
-
-
Save mattkirwan/4219785 to your computer and use it in GitHub Desktop.
AvailableTask value attribute - possible type inconsistencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="test" default="test"> | |
<property name="dir" value="../test_directory" /> | |
<target name="test"> | |
<echo message="Test 1:" /> | |
<echo message="--------------------" /> | |
<!-- Test 1: Value attribute not declared. | |
Defaults to "true" (as per docs). | |
--> | |
<available file="${dir}" type="dir" property="test1.dir.exists" /> | |
<echo message="AvailableTask value attribute: NOT SET" /> | |
<echo message="--------------------" /> | |
<echo message="Actual AvailableTask value: ${test1.dir.exists}" /> | |
<echo message="--------------------" /> | |
<echo message="If arg2 = 'true' (string)" /> | |
<if> | |
<equals arg1="${test1.dir.exists}" arg2="true" /> | |
<then> | |
<echo message="Pass" /> | |
</then> | |
<else> | |
<echo message="Fail" /> | |
</else> | |
</if> | |
<echo message="--------------------" /> | |
<echo message="If arg2 = '1' (string)" /> | |
<if> | |
<equals arg1="${test1.dir.exists}" arg2="1" /> | |
<then> | |
<echo message="Pass" /> | |
</then> | |
<else> | |
<echo message="Fail" /> | |
</else> | |
</if> | |
<echo message="--------------------" /> | |
<echo message="--------------------" /> | |
<echo message="--------------------" /> | |
<echo message="--------------------" /> | |
<echo message="--------------------" /> | |
<echo message="Test 2:" /> | |
<echo message="--------------------" /> | |
<!-- Test 2: Value attribute declared as true (assumed string type). | |
--> | |
<available file="${dir}" type="dir" property="test2.dir.exists" value="true" /> | |
<echo message="AvailableTask value attribute: 'true' (string)" /> | |
<echo message="--------------------" /> | |
<echo message="Actual AvailableTask value: ${test2.dir.exists}" /> | |
<echo message="--------------------" /> | |
<echo message="If arg2 = 'true' (string)" /> | |
<if> | |
<equals arg1="${test2.dir.exists}" arg2="true" /> | |
<then> | |
<echo message="Pass." /> | |
</then> | |
<else> | |
<echo message="Fail" /> | |
</else> | |
</if> | |
<echo message="--------------------" /> | |
<echo message="If arg2 = '1' (string)" /> | |
<if> | |
<equals arg1="${test2.dir.exists}" arg2="1" /> | |
<then> | |
<echo message="Pass" /> | |
</then> | |
<else> | |
<echo message="Fail" /> | |
</else> | |
</if> | |
<echo message="--------------------" /> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment