adammurdoch 2002/06/25 04:23:29
Added: antlib/src/test/org/apache/antlib/project/test
AntCallTaskTestCase.java ant-call.ant
common-project.ant
Removed: antlib/src/test/org/apache/antlib/project/test
AbstractAntTaskTestCase.java
Log:
Some unit tests for <ant-call> (not complete, by any stretch).
Revision Changes Path
1.1
jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/project/test/AntCallTaskTestCase.java
Index: AntCallTaskTestCase.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.antlib.project.test;
import org.apache.antlib.AbstractProjectTestCase;
import java.io.File;
/**
* Test cases for the <ant-call> task.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/06/25 11:23:29 $
*/
public class AntCallTaskTestCase
extends AbstractProjectTestCase
{
public AntCallTaskTestCase( final String name )
{
super( name );
}
public void testEvaluation() throws Exception
{
final File projectFile = getTestResource( "ant-call.ant" );
executeTarget( projectFile, "default-target" );
executeTarget( projectFile, "call-target" );
executeTarget( projectFile, "unknown-target" );
executeTarget( projectFile, "ref-default" );
executeTarget( projectFile, "ref-target" );
executeTarget( projectFile, "ref-unknown-target" );
}
}
1.1
jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/project/test/ant-call.ant
Index: ant-call.ant
===================================================================
<!-- Test cases for the <ant-call> task. -->
<project version="2.0">
<projectref name="common" location="common-project.ant"/>
<!-- Call default target -->
<target name="default-target">
<expect-output absolute-path="true">
<out>
<ant-call>
<main>
<log>In default target.</log>
</main>
</ant-call>
</out>
<tasks>
<ant-call/>
</tasks>
</expect-output>
</target>
<!-- Call a target -->
<target name="call-target">
<expect-output absolute-path="true">
<out>
<ant-call>
<other-target>
<log>In other target.</log>
</other-target>
</ant-call>
</out>
<tasks>
<ant-call target="other-target"/>
</tasks>
</expect-output>
</target>
<!-- Call unknown target -->
<target name="unknown-target">
<expect-error>
<exc>Execution of target "no-such-target" in project
"${project.uri}" failed.</exc>
<exc>No target named "no-such-target" in project
"${project.uri}".</exc>
<tasks>
<ant-call target="no-such-target"/>
</tasks>
</expect-error>
</target>
<!-- Call the default target in a referenced project -->
<target name="ref-default">
<expect-output absolute-path="true">
<out>
<common-project>
<main>
<log>common: In default target.</log>
</main>
</common-project>
</out>
<tasks>
<ant-call project="common"/>
</tasks>
</expect-output>
</target>
<!-- Call a target in a referenced project -->
<target name="ref-target">
<expect-output absolute-path="true">
<out>
<common-project>
<other-target>
<log>common: In other target.</log>
</other-target>
</common-project>
</out>
<tasks>
<ant-call project="common" target="other-target"/>
</tasks>
</expect-output>
</target>
<!-- Call an unknown target in a referenced project -->
<target name="ref-unknown-target">
<expect-error>
<exc>Execution of target "no-such-target" in project
"${projectref.common.uri}" failed.</exc>
<exc>No target named "no-such-target" in project
"${projectref.common.uri}".</exc>
<tasks>
<ant-call project="common" target="no-such-target"/>
</tasks>
</expect-error>
</target>
<!--
Targets called by the tests
-->
<target name="main">
<log>In default target.</log>
</target>
<target name="other-target">
<log>In other target.</log>
</target>
</project>
1.1
jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/project/test/common-project.ant
Index: common-project.ant
===================================================================
<project version="2.0">
<target name="main">
<log>common: In default target.</log>
</target>
<target name="other-target">
<log>common: In other target.</log>
</target>
</project>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>