aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok/LombokTestSource.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/src/lombok/LombokTestSource.java')
-rw-r--r--test/core/src/lombok/LombokTestSource.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
index 16f9f49f..31f7db3e 100644
--- a/test/core/src/lombok/LombokTestSource.java
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -29,6 +29,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -55,7 +56,14 @@ public class LombokTestSource {
private final int versionLowerLimit, versionUpperLimit;
private final ConfigurationResolver configuration;
private final String specifiedEncoding;
+ private final List<String> platforms;
+ public boolean runOnPlatform(String platform) {
+ if (platforms == null || platforms.isEmpty()) return true;
+ for (String pl : platforms) if (pl.equalsIgnoreCase(platform)) return true;
+ return false;
+ }
+
public boolean versionWithinLimit(int version) {
return version >= versionLowerLimit && version <= versionUpperLimit;
}
@@ -145,6 +153,7 @@ public class LombokTestSource {
boolean unchanged = false;
String encoding = null;
Map<String, String> formats = new HashMap<String, String>();
+ String[] platformLimit = null;
for (String directive : directives) {
directive = directive.trim();
@@ -164,6 +173,14 @@ public class LombokTestSource {
continue;
}
+ if (lc.startsWith("platform ")) {
+ String platformDesc = lc.substring("platform ".length());
+ int idx = platformDesc.indexOf(':');
+ if (idx != -1) platformDesc = platformDesc.substring(0, idx).trim();
+ platformLimit = platformDesc.split("\\s*,\\s*");
+ continue;
+ }
+
if (lc.startsWith("version ")) {
int[] limits = parseVersionLimit(lc.substring(7).trim());
if (limits == null) {
@@ -207,6 +224,7 @@ public class LombokTestSource {
this.ignore = ignore;
this.skipCompareContent = skipCompareContent;
this.unchanged = unchanged;
+ this.platforms = platformLimit == null ? null : Arrays.asList(platformLimit);
ConfigurationProblemReporter reporter = new ConfigurationProblemReporter() {
@Override public void report(String sourceDescription, String problem, int lineNumber, CharSequence line) {
Assert.fail("Problem on directive line: " + problem + " at conf line #" + lineNumber + " (" + line + ")");