From 632027249b813bfabd457c07ebc89c4456e8175d Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 10 Nov 2010 22:19:46 +0100 Subject: All tests pass! - The test framework has been updated a bit to fit with the new way delombok works. --- test/core/src/lombok/AbstractRunTests.java | 16 +++++++++++++--- test/core/src/lombok/DirectoryRunner.java | 8 +++----- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'test/core/src') 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 { -- cgit