aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok/CompilerMessageMatcher.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-05-08 00:38:50 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-05-08 00:39:59 +0200
commit844995fc606085af7c102954ee342edfd8cd623a (patch)
treeccba4f3c6bb6cedc9798f76d2f32e32395e887b3 /test/core/src/lombok/CompilerMessageMatcher.java
parent7f85149f3959335f1be3e75f3695e00fb1cd3594 (diff)
downloadlombok-844995fc606085af7c102954ee342edfd8cd623a.tar.gz
lombok-844995fc606085af7c102954ee342edfd8cd623a.tar.bz2
lombok-844995fc606085af7c102954ee342edfd8cd623a.zip
All tests now succeed on all platforms again;
'optional' expected messages added. expanded some tests. Added a check if the bootclasspath supports a certain version, i.e. don't try to run a JDK7-only test if AutoClosable isn't available.
Diffstat (limited to 'test/core/src/lombok/CompilerMessageMatcher.java')
-rw-r--r--test/core/src/lombok/CompilerMessageMatcher.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/core/src/lombok/CompilerMessageMatcher.java b/test/core/src/lombok/CompilerMessageMatcher.java
index cffad88a..0d6c0889 100644
--- a/test/core/src/lombok/CompilerMessageMatcher.java
+++ b/test/core/src/lombok/CompilerMessageMatcher.java
@@ -37,9 +37,14 @@ public class CompilerMessageMatcher {
/** Line Number (starting at 1) */
private final List<Integer> lineNumbers = new ArrayList<Integer>();
private final List<List<String>> messages = new ArrayList<List<String>>();
+ private boolean optional;
private CompilerMessageMatcher() {}
+ public boolean isOptional() {
+ return optional;
+ }
+
public static CompilerMessageMatcher asCompilerMessageMatcher(CompilerMessage message) {
CompilerMessageMatcher cmm = new CompilerMessageMatcher();
cmm.lineNumbers.add((int) message.getLine());
@@ -50,7 +55,7 @@ public class CompilerMessageMatcher {
@Override public String toString() {
StringBuilder out = new StringBuilder();
for (int i = 0; i < lineNumbers.size(); i++) {
- out.append(lineNumbers.get(i));
+ out.append(lineNumbers.get(i)).append(" ");
for (String part : messages.get(i)) out.append(part).append(" ");
if (out.length() > 0) out.setLength(out.length() - 1);
out.append(" |||| ");
@@ -87,10 +92,17 @@ public class CompilerMessageMatcher {
private static CompilerMessageMatcher read(String line) {
line = line.trim();
if (line.isEmpty()) return null;
+ boolean optional = false;
+
+ if (line.startsWith("OPTIONAL ")) {
+ line = line.substring(9);
+ optional = true;
+ }
String[] parts = line.split("\\s*\\|\\|\\|\\|\\s*");
CompilerMessageMatcher cmm = new CompilerMessageMatcher();
+ cmm.optional = optional;
for (String part : parts) {
Matcher m = PATTERN.matcher(part);
if (!m.matches()) throw new IllegalArgumentException("Typo in test file: " + line);