aboutsummaryrefslogtreecommitdiff
path: root/test/delombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2009-11-27 04:18:28 +0100
committerRoel Spilker <r.spilker@gmail.com>2009-11-27 04:23:41 +0100
commit391db3dcecdd0d94eb76b656e655346891b02bb4 (patch)
tree592d79167f4f5a6ce92813cfd962fa51228d3ee0 /test/delombok
parente54c3f36e3122dfe34a119178cfcca2dcdbad998 (diff)
downloadlombok-391db3dcecdd0d94eb76b656e655346891b02bb4.tar.gz
lombok-391db3dcecdd0d94eb76b656e655346891b02bb4.tar.bz2
lombok-391db3dcecdd0d94eb76b656e655346891b02bb4.zip
Thorough work on inserting comments in the proper place for delombok; should now work fine with GWT native methods!
NON-NLS-1 is still theoretically problematic, but that'll be a fix for another day. Also added ability to recognize that nothing has changed, which will copy the original file instead of reparsing it.
Diffstat (limited to 'test/delombok')
-rw-r--r--test/delombok/src/lombok/delombok/TestLombokFiles.java6
-rw-r--r--test/delombok/src/lombok/delombok/TestSourceFiles.java7
2 files changed, 9 insertions, 4 deletions
diff --git a/test/delombok/src/lombok/delombok/TestLombokFiles.java b/test/delombok/src/lombok/delombok/TestLombokFiles.java
index 10782830..f04a0a34 100644
--- a/test/delombok/src/lombok/delombok/TestLombokFiles.java
+++ b/test/delombok/src/lombok/delombok/TestLombokFiles.java
@@ -52,10 +52,9 @@ public class TestLombokFiles {
public void testSources() throws Exception {
File[] listFiles = BEFORE_FOLDER.listFiles();
for (File file : listFiles) {
- ParseResult parseResult = parser.parseFile(file.toString());
+ ParseResult parseResult = parser.parse(file.toString(), true);
StringWriter writer = new StringWriter();
parseResult.print(writer);
- System.out.println(writer);
compare(file.getName(), readAfter(file), writer.toString());
}
}
@@ -63,6 +62,9 @@ public class TestLombokFiles {
private void compare(String name, String expectedFile, String actualFile) {
String[] expectedLines = expectedFile.split("(\\r?\\n)");
String[] actualLines = actualFile.split("(\\r?\\n)");
+ if (actualLines[0].startsWith("// Generated by delombok at ")) {
+ actualLines[0] = "";
+ }
expectedLines = removeBlanks(expectedLines);
actualLines = removeBlanks(actualLines);
int size = Math.min(expectedLines.length, actualLines.length);
diff --git a/test/delombok/src/lombok/delombok/TestSourceFiles.java b/test/delombok/src/lombok/delombok/TestSourceFiles.java
index b662651d..91ace773 100644
--- a/test/delombok/src/lombok/delombok/TestSourceFiles.java
+++ b/test/delombok/src/lombok/delombok/TestSourceFiles.java
@@ -53,7 +53,7 @@ public class TestSourceFiles {
public void testSources() throws Exception {
File[] listFiles = BEFORE_FOLDER.listFiles();
for (File file : listFiles) {
- ParseResult parseResult = parser.parseFile(file.toString());
+ ParseResult parseResult = parser.parse(file.toString(), true);
StringWriter writer = new StringWriter();
parseResult.print(writer);
compare(file.getName(), readAfter(file), writer.toString());
@@ -71,6 +71,9 @@ public class TestSourceFiles {
private void compare(String name, String expectedFile, String actualFile) {
String[] expectedLines = expectedFile.split("(\\r?\\n)");
String[] actualLines = actualFile.split("(\\r?\\n)");
+ if (actualLines[0].startsWith("// Generated by delombok at ")) {
+ actualLines[0] = "";
+ }
expectedLines = removeBlanks(expectedLines);
actualLines = removeBlanks(actualLines);
int size = Math.min(expectedLines.length, actualLines.length);
@@ -78,7 +81,7 @@ public class TestSourceFiles {
String expected = expectedLines[i];
String actual = actualLines[i];
if (!expected.equals(actual)) {
- fail(String.format("Difference in line %s(%d):\n`%s`\n`%s`\n", name, i, expected, actual));
+ fail(String.format("Difference in line %s(%d):\nExpected `%s`\nGot `%s`\n", name, i, expected, actual));
}
}
if (expectedLines.length > actualLines.length) {