add a assertPropertyNotSet assertion
This commit is contained in:
parent
1d98715cab
commit
d00b9e0833
|
|
@ -45,6 +45,9 @@
|
|||
|
||||
Only works properly with Ant 1.10.13 or later.
|
||||
</action>
|
||||
<action type="add">
|
||||
Add a new assertPropertyNotSet assertion.
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.4.1" date="2021-07-07">
|
||||
<action type="fix" issue="65315">
|
||||
|
|
|
|||
|
|
@ -86,6 +86,15 @@ under the License.
|
|||
<au:assertPropertySet name="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotSetPass">
|
||||
<au:assertPropertyNotSet name="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotSetFail">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyNotSet name="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyEqualsPass">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyEquals name="foo" value="bar"/>
|
||||
|
|
|
|||
|
|
@ -99,6 +99,19 @@ under the License.
|
|||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertyNotSet" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="message"
|
||||
default="Expected property '@{name}' to not be set but was '${@{name}}'"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<not>
|
||||
<isset property="@{name}"/>
|
||||
</not>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertyEquals" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ public class AssertTest extends BuildFileTest {
|
|||
public void testPropertySetPass() {
|
||||
testPass("assertPropertySetPass");
|
||||
}
|
||||
public void testPropertyNotSetPass() {
|
||||
testPass("assertPropertyNotSetPass");
|
||||
}
|
||||
public void testPropertyEqualsPass() {
|
||||
testPass("assertPropertyEqualsPass");
|
||||
}
|
||||
|
|
@ -104,6 +107,9 @@ public class AssertTest extends BuildFileTest {
|
|||
public void testPropertySetFail() {
|
||||
testFail("assertPropertySetFail", "Expected property 'foo'");
|
||||
}
|
||||
public void testPropertyNotSetFail() {
|
||||
testFail("assertPropertyNotSetFail", "Expected property 'foo' to not be set but was 'bar'");
|
||||
}
|
||||
public void testPropertyEqualsFail1() {
|
||||
testFail("assertPropertyEqualsFail1", "Expected property 'foo' to have value 'bar' but was '${foo}'");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue