summaryrefslogtreecommitdiffstats
path: root/test/resources/logic/switch.xml
blob: fbf8bef82a6040489824be11792c6314d01aedc7 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<project default="invalid">
  <target name="invalid">
    <fail>Don't call this file directly.</fail>
  </target>

  <target name="setup">
    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
      <classpath location="${antcontrib.jar}"/>
    </taskdef>
  </target>

  <target name="noValue" depends="setup">
    <switch/>
  </target>

  <target name="noChildren" depends="setup">
    <switch value="foo"/>
  </target>

  <target name="twoDefaults" depends="setup">
    <switch value="foo">
      <default/>
      <default/>
    </switch>
  </target>

  <target name="noMatch" depends="setup">
    <switch value="foo">
      <case value="bar"/>
    </switch>
  </target>

  <target name="caseNoValue" depends="setup">
    <switch value="foo">
      <case/>
    </switch>
  </target>

  <target name="testDefault" depends="setup">
    <switch value="foo">
      <case value="bar">
        <echo>In case</echo>
      </case>
      <default>
        <echo>In default</echo>
        <property name="inner" value="baz"/>
        <echo>${inner}</echo>
      </default>
    </switch>
  </target>

  <target name="testCase" depends="setup">
    <switch value="foo">
      <case value="foo">
        <echo>In case</echo>
        <property name="inner" value="baz"/>
        <echo>${inner}</echo>
      </case>
      <default>
        <echo>In default</echo>
      </default>
    </switch>
  </target>

  <target name="testCaseSensitive" depends="setup">
    <switch value="FOO">
      <case value="foo">
        <echo>In case</echo>
      </case>
      <default>
        <echo>In default</echo>
      </default>
    </switch>
  </target>

  <target name="testCaseInSensitive" depends="setup">
    <switch value="FOO" caseinsensitive="true">
      <case value="foo">
        <echo>In case</echo>
      </case>
      <default>
        <echo>In default</echo>
      </default>
    </switch>
  </target>

</project>