diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-07-10 02:50:38 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-07-10 02:57:45 +0200 |
commit | 1fd2401bade3db3bb3a1bd88727823776f39be0c (patch) | |
tree | 7dae9f71ce118dae54485cdf175fe51af39eb134 /test/core/src/lombok | |
parent | 32e7cd18571200c41736e70daa4815893e9ea8c3 (diff) | |
download | lombok-1fd2401bade3db3bb3a1bd88727823776f39be0c.tar.gz lombok-1fd2401bade3db3bb3a1bd88727823776f39be0c.tar.bz2 lombok-1fd2401bade3db3bb3a1bd88727823776f39be0c.zip |
[test] more flexible options for limiting your tests.
Diffstat (limited to 'test/core/src/lombok')
-rw-r--r-- | test/core/src/lombok/AbstractRunTests.java | 18 | ||||
-rw-r--r-- | test/core/src/lombok/DirectoryRunner.java | 10 |
2 files changed, 26 insertions, 2 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java index 6d2b6312..8e73e122 100644 --- a/test/core/src/lombok/AbstractRunTests.java +++ b/test/core/src/lombok/AbstractRunTests.java @@ -190,6 +190,8 @@ public abstract class AbstractRunTests { for (CompilerMessage actualMessage : actualMessages) { System.out.println(actualMessage); } + System.out.println("**** Actual File ******"); + System.out.println(lineNumber(actualFile)); System.out.println("*******************"); } if (dumpActualFilesHere != null) { @@ -199,6 +201,22 @@ public abstract class AbstractRunTests { } } + private CharSequence lineNumber(String content) { + StringBuilder out = new StringBuilder(); + int pos = 0; + int ln = 1; + while (true) { + out.append(String.format("%4d ", ln)); + int idx = content.indexOf('\n', pos); + if (idx == -1) { + return out.append(content.substring(pos)); + } + out.append(content.substring(pos, idx + 1)); + ln++; + pos = idx + 1; + } + } + @SuppressWarnings("null") /* eclipse bug workaround; it falsely thinks stuffAc will always be null. */ private static void compareMessages(String name, LombokImmutableList<CompilerMessageMatcher> expected, LinkedHashSet<CompilerMessage> actual) { Iterator<CompilerMessageMatcher> expectedIterator = expected.iterator(); diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java index e4792ca9..a174355d 100644 --- a/test/core/src/lombok/DirectoryRunner.java +++ b/test/core/src/lombok/DirectoryRunner.java @@ -47,7 +47,7 @@ public class DirectoryRunner extends Runner { @Override public int getVersion() { return Javac.getJavaCompilerVersion(); } - }, + }, JAVAC { @Override public int getVersion() { return DELOMBOK.getVersion(); @@ -85,11 +85,17 @@ public class DirectoryRunner extends Runner { if (!file.isFile() || !file.getName().endsWith(".java")) return false; boolean positiveFilter = false; for (String dfof : DEBUG_FOCUS_ON_FILE) { + if (dfof.isEmpty()) continue; if (!dfof.endsWith(".java")) dfof = dfof + ".java"; boolean invert = dfof.startsWith("!"); if (invert) dfof = dfof.substring(1); positiveFilter = positiveFilter || !invert; - if (file.getName().equals(dfof)) return !invert; + int starIdx = dfof.indexOf('*'); + if (starIdx == -1) { + if (file.getName().equals(dfof)) return !invert; + } else { + if (file.getName().startsWith(dfof.substring(0, starIdx)) && file.getName().endsWith(dfof.substring(starIdx + 1))) return !invert; + } } return !positiveFilter; } |