summaryrefslogtreecommitdiffstats
path: root/test/antunit/property/variable.xml
diff options
context:
space:
mode:
Diffstat (limited to 'test/antunit/property/variable.xml')
-rw-r--r--test/antunit/property/variable.xml72
1 files changed, 72 insertions, 0 deletions
diff --git a/test/antunit/property/variable.xml b/test/antunit/property/variable.xml
new file mode 100644
index 0000000..acd3ad1
--- /dev/null
+++ b/test/antunit/property/variable.xml
@@ -0,0 +1,72 @@
+<project name="propertycopy"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:antcontrib="antlib:net.sf.antcontrib">
+ <import file="../common.xml" />
+
+ <!-- use like a standard property -->
+ <target name="test1">
+ <antcontrib:var name="x" value="6" />
+ <au:assertPropertyEquals name="x" value="6" />
+ </target>
+
+ <!-- use like a standard property -->
+ <target name="test2">
+ <antcontrib:var name="x" value="12" />
+ <au:assertPropertyEquals name="x" value="12" />
+ </target>
+
+ <!-- can append to itself -->
+ <target name="test3">
+ <antcontrib:var name="x" value="12" />
+ <antcontrib:var name="x" value="6 + ${x}" /> <!-- 6 + 12 -->
+ <au:assertPropertyEquals name="x" value="6 + 12" />
+ </target>
+
+ <!-- property can't override -->
+ <target name="test4">
+ <antcontrib:var name="x" value="6" />
+ <property name="x" value="12" />
+ <au:assertPropertyEquals name="x" value="6" />
+ </target>
+
+ <!-- can append multiple times -->
+ <target name="test5">
+ <antcontrib:var name="str" value="I" />
+ <antcontrib:var name="str" value="${str} am" />
+ <antcontrib:var name="str" value="${str} a" />
+ <antcontrib:var name="str" value="${str} string." />
+ <au:assertPropertyEquals name="str" value="I am a string." />
+ </target>
+
+ <!-- property can't override -->
+ <target name="test6">
+ <antcontrib:var name="x" value="blue" />
+ <tstamp>
+ <format property="x" pattern="EEEE" />
+ </tstamp>
+ <antcontrib:var name="x" value="Today is ${x}."/>
+ <au:assertPropertyEquals name="x" value="Today is blue." />
+ </target>
+
+ <!-- can override property -->
+ <target name="test7">
+ <property name="x" value="12" />
+ <antcontrib:var name="x" value="6" />
+ <au:assertPropertyEquals name="x" value="6" />
+ </target>
+
+ <target name="test9">
+ <property name="i" value="2"/>
+ <antcontrib:var name="i" unset="true"/>
+ <au:assertTrue>
+ <not><isset property="i" /></not>
+ </au:assertTrue>
+ </target>
+
+ <target name="test10">
+ <antcontrib:var name="x" value="test"/>
+ <antcontrib:var name="x" unset="true"/>
+ <property name="x" value="xxx"/>
+ <au:assertPropertyEquals name="x" value="xxx" />
+ </target>
+</project> \ No newline at end of file