Skip to content

Commit

Permalink
test: use system dependent new line character in assertions (#2457)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky authored and monperrus committed Sep 11, 2018
1 parent ca7ee36 commit e6d4074
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions src/test/java/spoon/test/imports/ImportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1319,20 +1319,21 @@ public void testNullable() throws Exception {

@Test
public void testBug2369_fqn() throws Exception {
// https://github.com/INRIA/spoon/issues/2369
// see https://github.com/INRIA/spoon/issues/2369
final Launcher launcher = new Launcher();
launcher.addInputResource("./src/test/java/spoon/test/imports/testclasses/JavaLongUse.java");
launcher.buildModel();
assertEquals("public class JavaLongUse {\n" +
" public class Long {}\n" +
"\n" +
" public static long method() {\n" +
" return java.lang.Long.parseLong(\"10000\");\n" +
" }\n" +
"\n" +
" public static void main(java.lang.String[] args) {\n" +
" java.lang.System.out.println(spoon.test.imports.testclasses.JavaLongUse.method());\n" +
" }\n" +
final String nl = System.lineSeparator();
assertEquals("public class JavaLongUse {" + nl +
" public class Long {}" + nl +
nl +
" public static long method() {" + nl +
" return java.lang.Long.parseLong(\"10000\");" + nl +
" }" + nl +
nl +
" public static void main(java.lang.String[] args) {" + nl +
" java.lang.System.out.println(spoon.test.imports.testclasses.JavaLongUse.method());" + nl +
" }" + nl +
"}", launcher.getFactory().Type().get("spoon.test.imports.testclasses.JavaLongUse").toString());
}

Expand All @@ -1343,16 +1344,17 @@ public void testBug2369_autoimports() throws Exception {
launcher.addInputResource("./src/test/java/spoon/test/imports/testclasses/JavaLongUse.java");
launcher.getEnvironment().setAutoImports(true);
launcher.buildModel();
assertEquals("public class JavaLongUse {\n" +
" public class Long {}\n" +
"\n" +
" public static long method() {\n" +
" return java.lang.Long.parseLong(\"10000\");\n" +
" }\n" +
"\n" +
" public static void main(String[] args) {\n" +
" System.out.println(JavaLongUse.method());\n" +
" }\n" +
final String nl = System.lineSeparator();
assertEquals("public class JavaLongUse {" + nl +
" public class Long {}" + nl +
"" + nl +
" public static long method() {" + nl +
" return java.lang.Long.parseLong(\"10000\");" + nl +
" }" + nl +
"" + nl +
" public static void main(String[] args) {" + nl +
" System.out.println(JavaLongUse.method());" + nl +
" }" + nl +
"}", launcher.getFactory().Type().get("spoon.test.imports.testclasses.JavaLongUse").toString());
}

Expand Down

0 comments on commit e6d4074

Please sign in to comment.