diff options
Diffstat (limited to 'test/core/src')
-rw-r--r-- | test/core/src/lombok/AbstractRunTests.java | 16 | ||||
-rw-r--r-- | test/core/src/lombok/DirectoryRunner.java | 8 |
2 files changed, 16 insertions, 8 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java index 7d5992be..7bf2f452 100644 --- a/test/core/src/lombok/AbstractRunTests.java +++ b/test/core/src/lombok/AbstractRunTests.java @@ -28,6 +28,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; +import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; @@ -35,17 +36,26 @@ import java.util.List; public abstract class AbstractRunTests { protected static final String LINE_SEPARATOR = System.getProperty("line.separator"); - public void compareFile(DirectoryRunner.TestParams params, File file) throws Throwable { + public boolean compareFile(DirectoryRunner.TestParams params, File file) throws Throwable { StringBuilder messages = new StringBuilder(); StringWriter writer = new StringWriter(); transformCode(messages, writer, file); + String expectedFile = readFile(params.getAfterDirectory(), file, false); + String expectedMessages = readFile(params.getMessagesDirectory(), file, true); + + StringReader r = new StringReader(expectedFile); + BufferedReader br = new BufferedReader(r); + if ("//ignore".equals(br.readLine())) return false; + compare( file.getName(), - readFile(params.getAfterDirectory(), file, false), + expectedFile, writer.toString(), - readFile(params.getMessagesDirectory(), file, true), + expectedMessages, messages.toString(), params.printErrors()); + + return true; } protected abstract void transformCode(StringBuilder message, StringWriter result, File file) throws Throwable; diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java index 89fe6ab0..f84198f8 100644 --- a/test/core/src/lombok/DirectoryRunner.java +++ b/test/core/src/lombok/DirectoryRunner.java @@ -118,15 +118,13 @@ public class DirectoryRunner extends Runner { } switch (params.getCompiler()) { case DELOMBOK: - new RunTestsViaDelombok().compareFile(params, file); - break; + return new RunTestsViaDelombok().compareFile(params, file); case ECJ: - new RunTestsViaEcj().compareFile(params, file); - break; + return new RunTestsViaEcj().compareFile(params, file); + default: case JAVAC: throw new UnsupportedOperationException(); } - return true; } private boolean mustIgnore(File file) throws FileNotFoundException, IOException { |