forked from typetools/stubparser
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to EISOP 3.34-eisop1 from 3.32-eisop1 (#56)
- Loading branch information
Showing
50 changed files
with
818 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...esting/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3936Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser. | ||
* Copyright (C) 2011, 2013-2023 The JavaParser Team. | ||
* | ||
* This file is part of JavaParser. | ||
* | ||
* JavaParser can be used either under the terms of | ||
* a) the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* b) the terms of the Apache License | ||
* | ||
* You should have received a copy of both licenses in LICENCE.LGPL and | ||
* LICENCE.APACHE. Please refer to those files for details. | ||
* | ||
* JavaParser is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
*/ | ||
|
||
package com.github.javaparser.printer.lexicalpreservation; | ||
|
||
import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; | ||
|
||
import com.github.javaparser.ast.body.VariableDeclarator; | ||
import com.github.javaparser.ast.expr.TextBlockLiteralExpr; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class Issue3936Test extends AbstractLexicalPreservingTest { | ||
static final String given = "package some.project;\n" | ||
+ "\n" | ||
+ "import java.util.Optional;\n" | ||
+ "\n" | ||
+ "public class SomeClass {\n" | ||
+ "\n" | ||
+ " String html = \"\" + \"<html>\\n\"\n" | ||
+ " + \"\\t<head>\\n\"\n" | ||
+ " + \"\\t\\t<meta charset=\\\"utf-8\\\">\\n\"\n" | ||
+ " + \"\\t</head>\\n\"\n" | ||
+ " + \"\\t<body class=\\\"default-view\\\" style=\\\"word-wrap: break-word;\\\">\\n\"\n" | ||
+ " + \"\\t\\t<p>Hello, world</p>\\n\"\n" | ||
+ " + \"\\t</body>\\n\"\n" | ||
+ " + \"</html>\\n\";\n" | ||
+ "}"; | ||
|
||
@Test | ||
void test() { | ||
considerCode(given); | ||
|
||
String newText = "\tfirstRow\n\tsecondRow\n\tthirdRow"; | ||
|
||
LexicalPreservingPrinter.setup(cu); | ||
|
||
VariableDeclarator expr = cu.findFirst(VariableDeclarator.class).get(); | ||
expr.setInitializer(new TextBlockLiteralExpr(newText)); | ||
|
||
String actual = LexicalPreservingPrinter.print(cu); | ||
String expected ="package some.project;\n" | ||
+ "\n" | ||
+ "import java.util.Optional;\n" | ||
+ "\n" | ||
+ "public class SomeClass {\n" | ||
+ "\n" | ||
+ " String html = \"\"\"\n" | ||
+ "\tfirstRow\n" | ||
+ "\tsecondRow\n" | ||
+ "\tthirdRow\"\"\";\n" | ||
+ "}"; | ||
assertEqualsStringIgnoringEol(expected, actual); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...esting/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3937Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (C) 2007-2010 Júlio Vilmar Gesser. | ||
* Copyright (C) 2011, 2013-2023 The JavaParser Team. | ||
* | ||
* This file is part of JavaParser. | ||
* | ||
* JavaParser can be used either under the terms of | ||
* a) the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* b) the terms of the Apache License | ||
* | ||
* You should have received a copy of both licenses in LICENCE.LGPL and | ||
* LICENCE.APACHE. Please refer to those files for details. | ||
* | ||
* JavaParser is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
*/ | ||
|
||
package com.github.javaparser.printer.lexicalpreservation; | ||
|
||
import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.github.javaparser.ast.expr.LambdaExpr; | ||
import com.github.javaparser.ast.expr.MethodCallExpr; | ||
import com.github.javaparser.ast.expr.NameExpr; | ||
import com.github.javaparser.ast.stmt.ExpressionStmt; | ||
|
||
public class Issue3937Test extends AbstractLexicalPreservingTest { | ||
static final String given = "package custom.project;\n" + "\n" | ||
+ "import java.util.stream.Stream;\n" | ||
+ "\n" | ||
+ "class TestFileSystemCodeProvider {\n" | ||
+ " void testInMemoryFileSystem() {\n" | ||
+ "\n" | ||
+ " Stream.of(\"\").listFilesForContent(file -> {\n" | ||
+ " System.out.println(s);\n" | ||
+ " });\n" | ||
+ " }\n" | ||
+ "}\n" | ||
+ ""; | ||
|
||
@Test | ||
void test() { | ||
considerCode(given); | ||
|
||
LexicalPreservingPrinter.setup(cu); | ||
|
||
LambdaExpr lambdaExpr = cu.findFirst(LambdaExpr.class).get(); | ||
lambdaExpr.setBody(new ExpressionStmt(new MethodCallExpr(new NameExpr("SomeClass"), "someMethod"))); | ||
|
||
String actual = LexicalPreservingPrinter.print(cu); | ||
String expected = "package custom.project;\n" | ||
+ "\n" | ||
+ "import java.util.stream.Stream;\n" | ||
+ "\n" | ||
+ "class TestFileSystemCodeProvider {\n" | ||
+ " void testInMemoryFileSystem() {\n" | ||
+ "\n" | ||
+ " Stream.of(\"\").listFilesForContent(file -> SomeClass.someMethod());\n" | ||
+ " }\n" | ||
+ "}\n" | ||
+ ""; | ||
assertEqualsStringIgnoringEol(expected, actual); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...esting/src/test/java/com/github/javaparser/printer/lexicalpreservation/Issue3949Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.github.javaparser.printer.lexicalpreservation; | ||
|
||
import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.github.javaparser.ast.expr.LambdaExpr; | ||
import com.github.javaparser.ast.stmt.BlockStmt; | ||
import com.github.javaparser.ast.stmt.BreakStmt; | ||
import com.github.javaparser.ast.stmt.ExpressionStmt; | ||
|
||
class Issue3949Test extends AbstractLexicalPreservingTest { | ||
|
||
@Test | ||
public void test() { | ||
considerCode( | ||
"class A {\n" | ||
+ "\n" | ||
+ " void foo() {\n" | ||
+ " Consumer<Integer> lambda = a -> System.out.println(a);\n" | ||
+ " }\n" | ||
+ "}"); | ||
|
||
ExpressionStmt estmt = cu.findAll(ExpressionStmt.class).get(1).clone(); | ||
LambdaExpr lexpr = cu.findAll(LambdaExpr.class).get(0); | ||
LexicalPreservingPrinter.setup(cu); | ||
|
||
BlockStmt block = new BlockStmt(); | ||
BreakStmt bstmt = new BreakStmt(); | ||
block.addStatement(new ExpressionStmt(estmt.getExpression())); | ||
block.addStatement(bstmt); | ||
lexpr.setBody(block); | ||
|
||
String expected = | ||
"class A {\n" | ||
+ "\n" | ||
+ " void foo() {\n" | ||
+ " Consumer<Integer> lambda = a -> {\n" | ||
+ " System.out.println(a);\n" | ||
+ " break;\n" | ||
+ " };\n" | ||
+ " }\n" | ||
+ "}"; | ||
|
||
assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu)); | ||
} | ||
|
||
} |
4 changes: 2 additions & 2 deletions
4
javaparser-core-testing/src/test/resources/com/github/javaparser/utils/Bla.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
class X { | ||
} | ||
class X { | ||
} |
4 changes: 2 additions & 2 deletions
4
javaparser-core-testing/src/test/resources/com/github/javaparser/utils/module-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
module M.N { | ||
} | ||
module M.N { | ||
} |
Oops, something went wrong.