diff --git a/src/etc/testcases/core/duplicate-target-imported.xml b/src/etc/testcases/core/duplicate-target-imported.xml new file mode 100644 index 000000000..389ba852c --- /dev/null +++ b/src/etc/testcases/core/duplicate-target-imported.xml @@ -0,0 +1,7 @@ + + + + + once from imported + + \ No newline at end of file diff --git a/src/etc/testcases/core/duplicate-target2.xml b/src/etc/testcases/core/duplicate-target2.xml new file mode 100644 index 000000000..8275e852b --- /dev/null +++ b/src/etc/testcases/core/duplicate-target2.xml @@ -0,0 +1,10 @@ + + + + + + + + once from buildfile + + \ No newline at end of file diff --git a/src/testcases/org/apache/tools/ant/ProjectTest.java b/src/testcases/org/apache/tools/ant/ProjectTest.java index ce2da05da..605d40412 100644 --- a/src/testcases/org/apache/tools/ant/ProjectTest.java +++ b/src/testcases/org/apache/tools/ant/ProjectTest.java @@ -204,13 +204,19 @@ public class ProjectTest extends TestCase { assertTrue(p.getTaskDefinitions().contains(org.apache.tools.ant.taskdefs.Echo.class)); } - // Bug in Ant 1.6/1.7 found by Dominique: there must no multiple - // targets with the same name in a project. public void testDuplicateTargets() { + // fail, because buildfile contains two targets with the same name BFT bft = new BFT("", "core/duplicate-target.xml"); bft.expectBuildException("twice", "Duplicate target"); } + public void testDuplicateTargetsImport() { + // overriding target from imported buildfile is allowed + BFT bft = new BFT("", "core/duplicate-target2.xml"); + bft.expectLog("once", "once from buildfile"); + } + + private class DummyTaskPrivate extends Task { public DummyTaskPrivate() {} public void execute() {}