Browse Source

tests for 38370

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@373999 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 19 years ago
parent
commit
a62ba1d050
3 changed files with 270 additions and 0 deletions
  1. +38
    -0
      src/etc/testcases/taskdefs/javadoc/java/ClassToJavadoc.java
  2. +111
    -0
      src/etc/testcases/taskdefs/javadoc/javadoc.xml
  3. +121
    -0
      src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java

+ 38
- 0
src/etc/testcases/taskdefs/javadoc/java/ClassToJavadoc.java View File

@@ -0,0 +1,38 @@
/*
* Copyright 2006 The Apache Software Foundation
*
* Licensed 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.
*
*/
package etc.testcases.taskdefs.javadoc.java;

/**
* This is a simple class to provide grist for the javadoc mill
* while testing it.
*/
public class ClassToJavadoc {
/**
* @param anArgument A String that is ignored
*/
public void methodToJavadoc(String anArgument) { }

/**
* @see java.lang.Object#toString()
*/
public String toString() { return this.getClass().getName(); }
/**
* @return An arbitrary string.
*/
public String anotherString() {return "An arbitrary string.";}
}

+ 111
- 0
src/etc/testcases/taskdefs/javadoc/javadoc.xml View File

@@ -0,0 +1,111 @@
<!--
* Copyright 2006 The Apache Software Foundation
*
* Licensed 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 name="javadoc" basedir=".">
<path id="path.dirset">
<dirset dir="java/" />
</path>

<target name="dirsetPath">
<javadoc sourcepathref="path.dirset" packagenames="*" destdir="javadoc" />
</target>

<target name="dirsetPathWithoutPackagenames">
<javadoc sourcepathref="path.dirset" destdir="javadoc" />
</target>

<target name="nestedDirsetPath">
<javadoc packagenames="*" destdir="javadoc">
<sourcepath refid="path.dirset" />
</javadoc>
</target>

<path id="path.fileset">
<pathelement location="."/>
<fileset dir="java/" id="fileset.inpath">
<include name="**/*.java" />
</fileset>
</path>

<target name="filesetPath">
<javadoc sourcepathref="path.fileset" packagenames="*" destdir="javadoc" />
</target>

<target name="nestedFilesetPath">
<javadoc packagenames="*" destdir="javadoc">
<sourcepath refid="path.fileset" />
</javadoc>
</target>

<target name="nestedFilesetRefInPath">
<javadoc packagenames="*" destdir="javadoc">
<fileset refid="fileset.inpath" />
</javadoc>
</target>

<path id="path.filelist">
<pathelement location="."/>
<filelist dir="java/">
<file name="ClassToJavadoc.java" />
</filelist>
</path>

<target name="filelistPath">
<javadoc sourcepathref="path.filelist" packagenames="*"
destdir="javadoc" />
</target>

<target name="nestedFilelistPath">
<javadoc packagenames="*" destdir="javadoc">
<sourcepath refid="path.filelist" />
</javadoc>
</target>

<path id="path.pathelement.path">
<pathelement path="java/" />
</path>

<target name="pathelementPath">
<javadoc sourcepathref="path.pathelement.path"
packagenames="*" destdir="javadoc" />
</target>

<path id="path.pathelement.location">
<pathelement location="."/>
<pathelement path="java/ClassToJavadoc.java" />
</path>

<target name="pathelementLocationPath">
<javadoc sourcepathref="path.pathelement.location"
packagenames="*" destdir="javadoc" />
</target>

<target name="nestedSource">
<javadoc destdir="javadoc">
<source file="java/ClassToJavadoc.java" />
</javadoc>
</target>

<fileset dir="java/" id="fileset.simple">
<include name="**/*.java" />
</fileset>

<target name="nestedFilesetRef">
<javadoc destdir="javadoc">
<fileset refid="fileset.simple" />
</javadoc>
</target>
</project>

+ 121
- 0
src/testcases/org/apache/tools/ant/taskdefs/JavadocTest.java View File

@@ -0,0 +1,121 @@
/*
* Copyright 2006 The Apache Software Foundation
*
* Licensed 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.
*
*/

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileTest;

public class JavadocTest extends BuildFileTest {

public JavadocTest(String name) {
super(name);
}

private static final String BUILD_PATH = "src/etc/testcases/taskdefs/javadoc/";
private static final String BUILD_FILENAME = "javadoc.xml";
private static final String BUILD_FILE = BUILD_PATH + BUILD_FILENAME;

protected void setUp() throws Exception {
super.setUp();
configureProject(BUILD_FILE);
}

// PR 38370
public void testDirsetPath() throws Exception {
executeTarget("dirsetPath");
}

// PR 38370
public void XtestDirsetPathWithoutPackagenames() throws Exception {
try {
executeTarget("dirsetPathWithoutPackagenames");
} catch (BuildException e) {
fail("Contents of path should be picked up without specifying package names: " + e);
}
}

// PR 38370
public void testNestedDirsetPath() throws Exception {
executeTarget("nestedDirsetPath");
}

// PR 38370
public void testFilesetPath() throws Exception {
try {
executeTarget("filesetPath");
} catch (BuildException e) {
fail("A path can contain filesets: " + e);
}
}

// PR 38370
public void testNestedFilesetPath() throws Exception {
try {
executeTarget("nestedFilesetPath");
} catch (BuildException e) {
fail("A path can contain nested filesets: " + e);
}
}

// PR 38370
public void testFilelistPath() throws Exception {
try {
executeTarget("filelistPath");
} catch (BuildException e) {
fail("A path can contain filelists: " + e);
}
}

// PR 38370
public void testNestedFilelistPath() throws Exception {
try {
executeTarget("nestedFilelistPath");
} catch (BuildException e) {
fail("A path can contain nested filelists: " + e);
}
}

// PR 38370
public void testPathelementPath() throws Exception {
executeTarget("pathelementPath");
}

// PR 38370
public void testPathelementLocationPath() throws Exception {
try {
executeTarget("pathelementLocationPath");
} catch (BuildException e) {
fail("A path can contain pathelements pointing to a file: " + e);
}
}

// PR 38370
public void testNestedSource() throws Exception {
executeTarget("nestedSource");
}

// PR 38370
public void testNestedFilesetRef() throws Exception {
executeTarget("nestedFilesetRef");
}

// PR 38370
public void testNestedFilesetRefInPath() throws Exception {
executeTarget("nestedFilesetRefInPath");
}
}

Loading…
Cancel
Save