| <?xml version="1.0" encoding="utf-8"?>
|
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
|
|
|
| <!-- note relies on antunit built from svn trunk (1.1-alpha) -->
|
| <import file="../antunit-base.xml"/>
|
|
|
| <target name="setUp">
|
| <property name="file" location="${java.io.tmpdir}/echoed.xml"/>
|
| <echoxml file="${file}">
|
| <project>
|
| <property name="foo" value="bar" />
|
| <fail message="$$$${foo}=$${foo}">
|
| <condition>
|
| <istrue value="${mustfail}" />
|
| </condition>
|
| </fail>
|
| </project>
|
| </echoxml>
|
| </target>
|
|
|
| <target name="tearDown">
|
| <delete file="${file}"/>
|
| </target>
|
|
|
| <target name="testPass">
|
| <ant antfile="${file}"/>
|
| </target>
|
|
|
| <target name="testFail">
|
| <au:expectfailure expectedmessage="${foo}=bar" message="Should have thrown an exception">
|
| <ant antfile="${file}">
|
| <property name="mustfail" value="true" />
|
| </ant>
|
| </au:expectfailure>
|
| </target>
|
|
|
| <target name="testEmpty">
|
| <au:expectfailure expectedmessage="No nested XML specified" message="Should have thrown an exception">
|
| <echoxml />
|
| </au:expectfailure>
|
| </target>
|
|
|
| <target name="test-ns"> <!-- comment this if you don't have the svn trunk of antunit -->
|
| <echoxml file="${file}" xmlns:a="antlib:a">
|
| <a:something />
|
| </echoxml>
|
| <au:assertResourceContains resource="${file}" value="a:something"/>
|
| </target>
|
| </project>
|