fix: assertPropertyContains was not checking the value of the property but the name of the property.

git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/antunit/trunk@826221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas Lalevee 2009-10-17 10:41:04 +00:00
parent fa15dbd298
commit 2e0ffe0ee8
4 changed files with 21 additions and 1 deletions

View File

@ -48,6 +48,10 @@
Default XSLT stylesheets now properly escape XML in exception
stack traces.
</action>
<action type="fix">
assertPropertyContains was not checking the value of the property but
the name of the property.
</action>
</release>
<release version="1.1" date="2008-09-26">

View File

@ -102,6 +102,16 @@ under the License.
<au:assertPropertyEquals name="foo" value="BAR"/>
</target>
<target name="assertPropertyContains">
<property name="foo" value="bar"/>
<au:assertPropertyContains name="foo" value="ba"/>
</target>
<target name="assertPropertyContainsFail">
<property name="foo" value="bar"/>
<au:assertPropertyContains name="foo" value="foo"/>
</target>
<target name="assertFileExistsPass">
<au:assertFileExists file="assert.xml"/>
</target>

View File

@ -104,7 +104,7 @@ under the License.
<sequential>
<au:assertPropertySet message="@{message}" name="@{name}"/>
<au:assertTrue message="@{message}">
<contains string="@{name}" substring="@{value}"
<contains string="${@{name}}" substring="@{value}"
casesensitive="@{casesensitive}"/>
</au:assertTrue>
</sequential>

View File

@ -101,6 +101,12 @@ public class AssertTest extends BuildFileTest {
public void testPropertyEqualsFail3() {
testFail("assertPropertyEqualsFail3", "Expected property 'foo' to have value 'BAR' but was 'bar'");
}
public void testPropertyContains() {
testPass("assertPropertyContains");
}
public void testPropertyContainsFail() {
testFail("assertPropertyContainsFail", "Expected property 'foo' to contain value 'foo' but was 'bar'");
}
public void testFileExistsFail() {
testFail("assertFileExistsFail",
"Expected file 'assert.txt' to exist");