diff --git a/src/etc/testcases/antunit.xml b/src/etc/testcases/antunit.xml
index e2e4cd3..3b49356 100644
--- a/src/etc/testcases/antunit.xml
+++ b/src/etc/testcases/antunit.xml
@@ -80,6 +80,13 @@ under the License.
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/antunit/java-io.xml b/src/etc/testcases/antunit/java-io.xml
new file mode 100644
index 0000000..899bc28
--- /dev/null
+++ b/src/etc/testcases/antunit/java-io.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+ Not a self-contained build file
+
+
+
+
+
+
+
+
diff --git a/src/tests/junit/org/apache/ant/antunit/AntUnitTest.java b/src/tests/junit/org/apache/ant/antunit/AntUnitTest.java
index 5bd8364..dedf9ba 100644
--- a/src/tests/junit/org/apache/ant/antunit/AntUnitTest.java
+++ b/src/tests/junit/org/apache/ant/antunit/AntUnitTest.java
@@ -19,7 +19,10 @@
*/
package org.apache.ant.antunit;
+import java.io.PrintStream;
+
import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.DemuxOutputStream;
public class AntUnitTest extends BuildFileTest {
@@ -88,4 +91,26 @@ public class AntUnitTest extends BuildFileTest {
executeTarget("testNewProject");
}
+ public void testSystemIoHandling() {
+ PrintStream savedErr = System.err;
+ PrintStream savedOut = System.out;
+ try {
+ savedErr.flush();
+ savedOut.flush();
+ System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
+ System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
+
+ project.executeTarget("testSystemIoHandling");
+
+ } finally {
+ System.setOut(savedOut);
+ System.setErr(savedErr);
+ }
+ }
+
+ public static class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println("HelloWorld");
+ }
+ }
}