Browse Source

add tests for addConfigured()

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274908 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 22 years ago
parent
commit
6940d37dfe
2 changed files with 41 additions and 1 deletions
  1. +12
    -0
      src/etc/testcases/types/addtype.xml
  2. +29
    -1
      src/testcases/org/apache/tools/ant/types/AddTypeTest.java

+ 12
- 0
src/etc/testcases/types/addtype.xml View File

@@ -64,6 +64,12 @@
<typedef loaderref="nested.loader" classpathref="nested.classes"
name = "nested.condition.type"
classname="${nested.package}AddTypeTest$MyCondition"/>
<typedef loaderref="nested.loader" classpathref="nested.classes"
name = "myaddconfigured"
classname="${nested.package}AddTypeTest$MyAddConfigured"/>
<typedef loaderref="nested.loader" classpathref="nested.classes"
name = "myvalue"
classname="${nested.package}AddTypeTest$MyValue"/>
</target>

<target name="nested.a" depends="init">
@@ -112,4 +118,10 @@
</condition>
</target>

<target name="myaddconfigured" depends="init">
<myaddconfigured>
<myvalue>Value Set</myvalue>
</myaddconfigured>
</target>

</project>

+ 29
- 1
src/testcases/org/apache/tools/ant/types/AddTypeTest.java View File

@@ -118,7 +118,11 @@ public class AddTypeTest extends BuildFileTest {
"condition.condition.task", "task masking condition",
"doesn't support the nested");
}

public void testAddConfigured() {
expectLogContaining(
"myaddconfigured", "value is Value Setexecute: value is Value Set");
}
// The following will be used as types and tasks
public static interface A {}
@@ -161,4 +165,28 @@ public class AddTypeTest extends BuildFileTest {
}
}

public static class MyValue
{
private String text = "NOT SET YET";
public void addText(String text) {
this.text = text;
}
public String toString() {
return text;
}
}

public static class MyAddConfigured
extends Task
{
MyValue value;
public void addConfigured(MyValue value) {
log("value is " + value);
this.value = value;
}
public void execute() {
log("execute: value is " + value);
}
}

}

Loading…
Cancel
Save