Author: bodewig
Date: Wed Sep 3 07:17:21 2008
New Revision: 691622
URL: http://svn.apache.org/viewvc?rev=691622&view=rev
Log:
Tests for PR 45411
Added:
ant/core/trunk/src/tests/junit/org/example/junit/MultilineAsserts.java
(with props)
Modified:
ant/core/trunk/src/etc/testcases/taskdefs/optional/junit.xml
ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
Modified: ant/core/trunk/src/etc/testcases/taskdefs/optional/junit.xml
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/optional/junit.xml?rev=691622&r1=691621&r2=691622&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/optional/junit.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/optional/junit.xml Wed Sep 3
07:17:21 2008
@@ -258,4 +258,20 @@
</echo>
</target>
+ <!-- Bugzilla Issue 45411 -->
+ <target name="testMultilineAssertsNoFork">
+ <junit>
+ <test name="org.example.junit.MultilineAsserts"/>
+ <classpath refid="test"/>
+ </junit>
+ </target>
+
+ <!-- Bugzilla Issue 45411 -->
+ <target name="testMultilineAssertsFork">
+ <junit fork="true">
+ <test name="org.example.junit.MultilineAsserts"/>
+ <classpath refid="test"/>
+ </junit>
+ </target>
+
</project>
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java?rev=691622&r1=691621&r2=691622&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
(original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java Wed
Sep 3 07:17:21 2008
@@ -116,6 +116,16 @@
}
/**
+ * Assert that the given substring is not in the log messages.
+ */
+ public void assertLogNotContaining(String substring) {
+ String realLog = getLog();
+ assertFalse("didn't expect log to contain \"" + substring + "\" log
was \""
+ + realLog + "\"",
+ realLog.indexOf(substring) >= 0);
+ }
+
+ /**
* Assert that the given substring is in the output messages.
* @since Ant1.7
*/
@@ -161,6 +171,15 @@
}
/**
+ * Assert that the given message has not been logged with a
+ * priority <= INFO when running the given target.
+ */
+ public void expectLogNotContaining(String target, String log) {
+ executeTarget(target);
+ assertLogNotContaining(log);
+ }
+
+ /**
* Gets the log the BuildFileTest object.
* Only valid if configureProject() has been called.
*
Modified:
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java?rev=691622&r1=691621&r2=691622&view=diff
==============================================================================
---
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
(original)
+++
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
Wed Sep 3 07:17:21 2008
@@ -216,11 +216,22 @@
}
}
-
public void testBatchTestForkOnceCustomFormatter() {
assertResultFilesExist("testBatchTestForkOnceCustomFormatter", "foo");
}
+ // Bugzilla Issue 45411
+ public void testMultilineAssertsNoFork() {
+ expectLogNotContaining("testMultilineAssertsNoFork", "messed up)");
+ assertLogNotContaining("crashed)");
+ }
+
+ // Bugzilla Issue 45411
+ public void XtestMultilineAssertsFork() {
+ expectLogNotContaining("testMultilineAssertsFork", "messed up)");
+ assertLogNotContaining("crashed)");
+ }
+
private void assertResultFilesExist(String target, String extension) {
executeTarget(target);
assertResultFileExists("JUnitClassLoader", extension);
Added: ant/core/trunk/src/tests/junit/org/example/junit/MultilineAsserts.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/example/junit/MultilineAsserts.java?rev=691622&view=auto
==============================================================================
--- ant/core/trunk/src/tests/junit/org/example/junit/MultilineAsserts.java
(added)
+++ ant/core/trunk/src/tests/junit/org/example/junit/MultilineAsserts.java Wed
Sep 3 07:17:21 2008
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.example.junit;
+
+import junit.framework.TestCase;
+
+public class MultilineAsserts extends TestCase {
+ public void testFoo() { assertTrue("testFoo \nmessed up", false); }
+ public void testBar() { assertTrue("testBar \ndidn't work", true); }
+ public void testFee() { assertTrue("testFee \ncrashed", false); }
+ public void testFie() { assertTrue("testFie \nbroke", true); }
+}
Propchange:
ant/core/trunk/src/tests/junit/org/example/junit/MultilineAsserts.java
------------------------------------------------------------------------------
svn:eol-style = native