diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-11-10 22:19:46 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2010-11-10 22:19:46 +0100 |
commit | 632027249b813bfabd457c07ebc89c4456e8175d (patch) | |
tree | a18ebcdab6a9ba1c77d4625ef6f1fb15c8bab5ea /test/core/src/lombok | |
parent | 249566813149f8e6984561d9d2ba4e348974dc1a (diff) | |
download | lombok-632027249b813bfabd457c07ebc89c4456e8175d.tar.gz lombok-632027249b813bfabd457c07ebc89c4456e8175d.tar.bz2 lombok-632027249b813bfabd457c07ebc89c4456e8175d.zip |
All tests pass! - The test framework has been updated a bit to fit with the new way delombok works.
Diffstat (limited to 'test/core/src/lombok')
-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 { |