aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok/AbstractRunTests.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2016-11-22 00:37:07 +0100
committerRoel Spilker <r.spilker@gmail.com>2016-11-22 00:37:07 +0100
commitd6f1116108754152377cb1e0e276dedb7ffabbab (patch)
treec5cf699157af47de3800c711855a798ad38b00b6 /test/core/src/lombok/AbstractRunTests.java
parent8c2ea4fbc64e8b7b4e553a6f8b9363eb0b70d76a (diff)
downloadlombok-d6f1116108754152377cb1e0e276dedb7ffabbab.tar.gz
lombok-d6f1116108754152377cb1e0e276dedb7ffabbab.tar.bz2
lombok-d6f1116108754152377cb1e0e276dedb7ffabbab.zip
`var` can now also be configured to emit a warning when used.
Diffstat (limited to 'test/core/src/lombok/AbstractRunTests.java')
-rw-r--r--test/core/src/lombok/AbstractRunTests.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index f564d0dc..d044a39f 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -57,10 +57,16 @@ public abstract class AbstractRunTests {
public final FileTester createTester(final DirectoryRunner.TestParams params, final File file) throws IOException {
ConfigurationKeysLoader.LoaderLoader.loadAllConfigurationKeys();
- final LombokTestSource sourceDirectives = LombokTestSource.readDirectives(file);
- if (sourceDirectives.isIgnore()) return null;
- if (!sourceDirectives.versionWithinLimit(params.getVersion())) return null;
- if (!sourceDirectives.versionWithinLimit(getClasspathVersion())) return null;
+ AssertionError directiveFailure = null;
+ LombokTestSource sourceDirectives = null;
+ try {
+ sourceDirectives = LombokTestSource.readDirectives(file);
+ if (sourceDirectives.isIgnore()) return null;
+ if (!sourceDirectives.versionWithinLimit(params.getVersion())) return null;
+ if (!sourceDirectives.versionWithinLimit(getClasspathVersion())) return null;
+ } catch (AssertionError ae) {
+ directiveFailure = ae;
+ }
String fileName = file.getName();
final LombokTestSource expected = LombokTestSource.read(params.getAfterDirectory(), params.getMessagesDirectory(), fileName);
@@ -68,23 +74,26 @@ public abstract class AbstractRunTests {
if (expected.isIgnore()) return null;
if (!expected.versionWithinLimit(params.getVersion())) return null;
+ final LombokTestSource sourceDirectives_ = sourceDirectives;
+ final AssertionError directiveFailure_ = directiveFailure;
return new FileTester() {
@Override public void runTest() throws Throwable {
+ if (directiveFailure_ != null) throw directiveFailure_;
LinkedHashSet<CompilerMessage> messages = new LinkedHashSet<CompilerMessage>();
StringWriter writer = new StringWriter();
LombokConfiguration.overrideConfigurationResolverFactory(new ConfigurationResolverFactory() {
@Override public ConfigurationResolver createResolver(AST<?, ?, ?> ast) {
- return sourceDirectives.getConfiguration();
+ return sourceDirectives_.getConfiguration();
}
});
- boolean changed = transformCode(messages, writer, file, sourceDirectives.getSpecifiedEncoding(), sourceDirectives.getFormatPreferences());
- boolean forceUnchanged = sourceDirectives.forceUnchanged() || sourceDirectives.isSkipCompareContent();
+ boolean changed = transformCode(messages, writer, file, sourceDirectives_.getSpecifiedEncoding(), sourceDirectives_.getFormatPreferences());
+ boolean forceUnchanged = sourceDirectives_.forceUnchanged() || sourceDirectives_.isSkipCompareContent();
if (params.expectChanges() && !forceUnchanged && !changed) messages.add(new CompilerMessage(-1, -1, true, "not flagged modified"));
if (!params.expectChanges() && changed) messages.add(new CompilerMessage(-1, -1, true, "unexpected modification"));
- compare(file.getName(), expected, writer.toString(), messages, params.printErrors(), sourceDirectives.isSkipCompareContent() || expected.isSkipCompareContent());
+ compare(file.getName(), expected, writer.toString(), messages, params.printErrors(), sourceDirectives_.isSkipCompareContent() || expected.isSkipCompareContent());
}
};
}