1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
<?xml version="1.0" encoding="UTF-8"?>
<project name="SwitchTaskTest" default="test">
<target name="testSwitchCase">
<property name="foo" value="bar"/>
<switch value="${foo}">
<case value="bar">
<echo message="The value of property foo is bar" />
</case>
<case value="baz">
<echo message="The value of property foo is baz" />
</case>
<default>
<echo message="The value of property foo is not sensible" />
</default>
</switch>
</target>
<target name="testSwitchCaseNumbers">
<property name="foo" value="1"/>
<switch value="${foo}">
<case value="0">
<echo message="The value of property foo is 0" />
</case>
<case value="1">
<echo message="The value of property foo is 1" />
</case>
<default>
<echo message="The value of property foo is not sensible" />
</default>
</switch>
</target>
<target name="testSwitchDefault">
<property name="bar" value="test"/>
<switch value="${bar}">
<case value="foo">
<echo message="The value of property bar is foo" />
</case>
<case value="baz">
<echo message="The value of property bar is baz" />
</case>
<default>
<echo message="The value of property bar is not sensible" />
</default>
</switch>
</target>
</project>
|