diff --git a/docs/assertions.html b/docs/assertions.html
index e56d04f..19db1b3 100644
--- a/docs/assertions.html
+++ b/docs/assertions.html
@@ -918,6 +918,13 @@
levels. One of "error", "warning", "info", "verbose", "debug".
No |
+
+ | mergeLines |
+ Whether to merge messages into a single
+ line or split them into multiple lines. |
+ No, defaults
+ to true |
+
@@ -944,6 +951,13 @@
levels. One of "error", "warning", "info", "verbose", "debug".
No |
+
+ | mergeLines |
+ Whether to merge messages into a single
+ line or split them into multiple lines. |
+ No, defaults
+ to true |
+
diff --git a/src/main/org/apache/ant/antunit/LogContains.java b/src/main/org/apache/ant/antunit/LogContains.java
index 36e0d76..b5531bd 100644
--- a/src/main/org/apache/ant/antunit/LogContains.java
+++ b/src/main/org/apache/ant/antunit/LogContains.java
@@ -37,6 +37,7 @@ public class LogContains extends ProjectComponent implements Condition {
private String text;
private int logLevel = Project.MSG_INFO;
+ private boolean mergeLines = true;
/**
* Test the log shall contain.
@@ -52,6 +53,14 @@ public class LogContains extends ProjectComponent implements Condition {
logLevel = echoLevel.getLevel();
}
+ /**
+ * Whether to merge messages into a single line or split them into
+ * multiple lines.
+ */
+ public void setMergeLines(boolean b) {
+ mergeLines = b;
+ }
+
public boolean eval() {
if (text == null) {
throw new BuildException("the text attribute is required");
@@ -62,19 +71,19 @@ public class LogContains extends ProjectComponent implements Condition {
String log;
switch (logLevel) {
case Project.MSG_ERR:
- log = c.getErrLog();
+ log = c.getErrLog(mergeLines);
break;
case Project.MSG_WARN:
- log = c.getWarnLog();
+ log = c.getWarnLog(mergeLines);
break;
case Project.MSG_INFO:
- log = c.getInfoLog();
+ log = c.getInfoLog(mergeLines);
break;
case Project.MSG_VERBOSE:
- log = c.getVerboseLog();
+ log = c.getVerboseLog(mergeLines);
break;
case Project.MSG_DEBUG:
- log = c.getDebugLog();
+ log = c.getDebugLog(mergeLines);
break;
default:
diff --git a/src/main/org/apache/ant/antunit/antlib.xml b/src/main/org/apache/ant/antunit/antlib.xml
index 53f27a9..4ed528b 100644
--- a/src/main/org/apache/ant/antunit/antlib.xml
+++ b/src/main/org/apache/ant/antunit/antlib.xml
@@ -350,11 +350,13 @@ under the License.
+
-
+
@@ -362,11 +364,13 @@ under the License.
+
-
+
diff --git a/src/tests/antunit/assertLogContains-test.xml b/src/tests/antunit/assertLogContains-test.xml
new file mode 100644
index 0000000..6d84e4e
--- /dev/null
+++ b/src/tests/antunit/assertLogContains-test.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+ 0
+ 1
+
+
+
+
+
+ 0
+ 1
+
+
+
+
+
+ 0
+ 1
+
+
+
+