File: SwitchTest.xml

package info (click to toggle)
phing 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 9,340 kB
  • sloc: php: 59,826; xml: 9,770; sql: 78; makefile: 39; sh: 14
file content (45 lines) | stat: -rw-r--r-- 1,604 bytes parent folder | download | duplicates (2)
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>