From 391db3dcecdd0d94eb76b656e655346891b02bb4 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Fri, 27 Nov 2009 04:18:28 +0100 Subject: 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. --- test/delombok/src/lombok/delombok/TestLombokFiles.java | 6 ++++-- test/delombok/src/lombok/delombok/TestSourceFiles.java | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'test/delombok') 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) { -- cgit