Browse Source

failing test for PR 26917, not sure whether this is a bug

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@809976 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
7af3e2519e
2 changed files with 34 additions and 2 deletions
  1. +3
    -0
      src/etc/testcases/core/unknownelement.xml
  2. +31
    -2
      src/tests/junit/org/apache/tools/ant/UnknownElementTest.java

+ 3
- 0
src/etc/testcases/core/unknownelement.xml View File

@@ -33,4 +33,7 @@
<child/> <child/>
</parent> </parent>
</target> </target>
<target name="echo">
<echo message="Hello, world!"/>
</target>
</project> </project>

+ 31
- 2
src/tests/junit/org/apache/tools/ant/UnknownElementTest.java View File

@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;



public class UnknownElementTest extends BuildFileTest { public class UnknownElementTest extends BuildFileTest {
public void setUp() { public void setUp() {
configureProject("src/etc/testcases/core/unknownelement.xml"); configureProject("src/etc/testcases/core/unknownelement.xml");
@@ -32,6 +31,36 @@ public class UnknownElementTest extends BuildFileTest {
executeTarget("testMaybeConfigure"); executeTarget("testMaybeConfigure");
} }


/**
* Not really a UnknownElement test but rather one of "what
* information is available in taskFinished".
* @see https://issues.apache.org/bugzilla/show_bug.cgi?id=26197
*/
public void XtestTaskFinishedEvent() {
getProject().addBuildListener(new BuildListener() {
public void buildStarted(BuildEvent event) {}
public void buildFinished(BuildEvent event) {}
public void targetStarted(BuildEvent event) {}
public void targetFinished(BuildEvent event) {}
public void taskStarted(BuildEvent event) {
assertTaskProperties(event.getTask());
}
public void taskFinished(BuildEvent event) {
assertTaskProperties(event.getTask());
}
public void messageLogged(BuildEvent event) {}
private void assertTaskProperties(Task ue) {
assertNotNull(ue);
assertTrue(ue instanceof UnknownElement);
Task t = ((UnknownElement) ue).getTask();
assertNotNull(t);
assertEquals("org.apache.tools.ant.taskdefs.Echo",
t.getClass().getName());
}
});
executeTarget("echo");
}

public static class Child extends Task { public static class Child extends Task {
Parent parent; Parent parent;
public void injectParent(Parent parent) { public void injectParent(Parent parent) {
@@ -51,7 +80,7 @@ public class UnknownElementTest extends BuildFileTest {
public void fromChild() { public void fromChild() {
log("fromchild"); log("fromchild");
} }
public void execute() { public void execute() {
for (Iterator i = children.iterator(); i.hasNext();) { for (Iterator i = children.iterator(); i.hasNext();) {
UnknownElement el = (UnknownElement) i.next(); UnknownElement el = (UnknownElement) i.next();


Loading…
Cancel
Save