aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/OutputSpec.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/OutputSpec.java b/testing/src/test/java/org/aspectj/testing/OutputSpec.java
index 14fc3bb62..def3990ec 100644
--- a/testing/src/test/java/org/aspectj/testing/OutputSpec.java
+++ b/testing/src/test/java/org/aspectj/testing/OutputSpec.java
@@ -127,8 +127,11 @@ public class OutputSpec {
}
private String[] getTrimmedLines(String text) {
- // Remove leading/trailing empty lines and leading/trailing whitespace from each line
- String[] trimmedLines = text.trim().split("\\s*\n\\s*");
+ // Remove leading/trailing empty lines and leading/trailing horizontal whitespace from each line.
+ // Regex character class '\h' is horizonal whitespace. We assume that lines are always separated by something
+ // containing a '\n' LF character, e.g. LF (UNIX), CRLF (Windows). For legacy Mac platforms with their CR-only line
+ // separators, this would not work, and it is not supposed to either.
+ String[] trimmedLines = text.trim().split("\\h*\r?\n\\h*");
return trimmedLines.length == 1 && trimmedLines[0].equals("") ? new String[0] : trimmedLines;
}
}