aboutsummaryrefslogtreecommitdiff
path: root/test/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2010-07-22 01:33:24 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2010-07-22 01:33:24 +0200
commit483e23d3853aa37a19390019fcf0db97ac8bc1d4 (patch)
tree1794c6fc66136f962ee4c9c6a229e39c0af827e5 /test/core
parent59e585a0c68959eb72be34524bdad19df5dc8a4d (diff)
downloadlombok-483e23d3853aa37a19390019fcf0db97ac8bc1d4.tar.gz
lombok-483e23d3853aa37a19390019fcf0db97ac8bc1d4.tar.bz2
lombok-483e23d3853aa37a19390019fcf0db97ac8bc1d4.zip
Added tests for ecj, fixed a few minor bugs that came out of that.
Diffstat (limited to 'test/core')
-rw-r--r--test/core/src/lombok/AbstractRunTests.java4
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java9
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java6
3 files changed, 15 insertions, 4 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index ad9c45af..4241646b 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -83,6 +83,10 @@ public abstract class AbstractRunTests {
System.out.println(expectedFile);
System.out.println("**** Actual ******");
System.out.println(actualFile);
+ if (actualMessages != null && !actualMessages.isEmpty()) {
+ System.out.println("**** Actual Errors *****");
+ System.out.println(actualMessages);
+ }
System.out.println("*******************");
}
throw e;
diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java
index 7f99b99e..50fad33e 100644
--- a/test/core/src/lombok/RunTestsViaDelombok.java
+++ b/test/core/src/lombok/RunTestsViaDelombok.java
@@ -24,6 +24,8 @@ package lombok;
import java.io.File;
import java.io.StringWriter;
import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
@@ -35,14 +37,17 @@ public class RunTestsViaDelombok extends AbstractRunTests {
private Delombok delombok = new Delombok();
@Override
- public void transformCode(final StringBuilder messages, StringWriter result, File file) throws Throwable {
+ public void transformCode(final StringBuilder messages, StringWriter result, final File file) throws Throwable {
delombok.setVerbose(false);
delombok.setForceProcess(true);
delombok.setCharset("UTF-8");
delombok.setDiagnosticsListener(new DiagnosticListener<JavaFileObject>() {
@Override public void report(Diagnostic<? extends JavaFileObject> d) {
- messages.append(String.format("%d:%d %s %s\n", d.getLineNumber(), d.getColumnNumber(), d.getKind(), d.getMessage(Locale.ENGLISH)));
+ String msg = d.getMessage(Locale.ENGLISH);
+ Matcher m = Pattern.compile("^" + Pattern.quote(file.getAbsolutePath()) + "\\s*:\\s*\\d+\\s*:\\s*(?:warning:\\s*)?(.*)$").matcher(msg);
+ if (m.matches()) msg = m.group(1);
+ messages.append(String.format("%d:%d %s %s\n", d.getLineNumber(), d.getColumnNumber(), d.getKind(), msg));
}
});
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 3f7d6e81..fa1501bc 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -47,8 +47,10 @@ public class RunTestsViaEcj extends AbstractRunTests {
TransformEclipseAST.transform(parser, cud);
- for (CategorizedProblem p : compilationResult.getErrors()) {
- messages.append(p.toString()).append("\n");
+ CategorizedProblem[] problems = compilationResult.getAllProblems();
+
+ if (problems != null) for (CategorizedProblem p : problems) {
+ messages.append(String.format("%d %s %s\n", p.getSourceLineNumber(), p.isError() ? "error" : p.isWarning() ? "warning" : "unknown", p.getMessage()));
}
result.append(cud.toString());