Thanks to Jan for the example on the userlist reminding me of my error. ;) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277336 13f79535-47bb-0310-9956-ffa450edef68master
@@ -104,6 +104,18 @@ | |||||
<length string="foo" file="${ant.file}" /> | <length string="foo" file="${ant.file}" /> | ||||
</target> | </target> | ||||
<target name="testImmutable"> | |||||
<length string="foo" property="length.string" /> | |||||
<length string="foobar" property="length.string" /> | |||||
<fail> | |||||
<condition> | |||||
<not> | |||||
<equals arg1="3" arg2="${length.string}" /> | |||||
</not> | |||||
</condition> | |||||
</fail> | |||||
</target> | |||||
<target name="cleanup"> | <target name="cleanup"> | ||||
<delete dir="${dir}" /> | <delete dir="${dir}" /> | ||||
</target> | </target> | ||||
@@ -190,7 +190,8 @@ public class Length extends Task { | |||||
private class PropertyOutputStream extends ByteArrayOutputStream { | private class PropertyOutputStream extends ByteArrayOutputStream { | ||||
public void close() { | public void close() { | ||||
getProject().setProperty(property, new String(toByteArray()).trim()); | |||||
getProject().setNewProperty( | |||||
property, new String(toByteArray()).trim()); | |||||
} | } | ||||
} | } | ||||
@@ -67,4 +67,8 @@ public class LengthTest extends BuildFileTest { | |||||
"should fail", "string length function only"); | "should fail", "string length function only"); | ||||
} | } | ||||
public void testImmutable() { | |||||
executeTarget("testImmutable"); | |||||
} | |||||
} | } |