mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tests
This commit is contained in:
+4
-2
@@ -29,13 +29,15 @@ import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
|
||||
public class GroovyWithTypeCastSurrounder extends GroovyExpressionSurrounder {
|
||||
protected TextRange surroundExpression(GrExpression expression) {
|
||||
GrParenthesizedExpression parenthesized = (GrParenthesizedExpression) GroovyPsiElementFactory.getInstance(expression.getProject()).createTopElementFromText("((Type)a)");
|
||||
parenthesized = (GrParenthesizedExpression) expression.replaceWithExpression(parenthesized, false);
|
||||
GrTypeCastExpression typeCast = (GrTypeCastExpression) parenthesized.getOperand();
|
||||
replaceToOldExpression(typeCast.getOperand(), expression);
|
||||
GrTypeElement typeElement = typeCast.getCastTypeElement();
|
||||
int endOffset = typeElement.getTextRange().getStartOffset();
|
||||
parenthesized = (GrParenthesizedExpression) expression.replaceWithExpression(parenthesized, false);
|
||||
|
||||
typeCast.getNode().removeChild(typeElement.getNode());
|
||||
final GrTypeCastExpression newTypeCast = (GrTypeCastExpression)parenthesized.getOperand();
|
||||
final GrTypeElement newTypeElement = newTypeCast.getCastTypeElement();
|
||||
newTypeElement.delete();
|
||||
return new TextRange(endOffset, endOffset);
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -289,4 +289,8 @@ public class GrIntroduceParameterTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testIncorrectArgumentList() {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, true);
|
||||
}
|
||||
|
||||
public void testClosure() {
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ protected def getGeneratedFileNames(String name, int boo) {
|
||||
-----
|
||||
protected def getGeneratedFileNames(String name, int boo) {
|
||||
def names
|
||||
names = <caret>testMethod()
|
||||
names = <caret>testMethod()
|
||||
names
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class S {
|
||||
Closure sin = {x -> Math.sin(x)}
|
||||
|
||||
|
||||
<caret>testMethod(sin)
|
||||
<caret>testMethod(sin)
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
new A().doSmth({ println "smth" })
|
||||
+1
@@ -0,0 +1 @@
|
||||
new A().doSmth()
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
void doSmth() {
|
||||
[1, 2, 3].each <selection>{ println "smth" }</selection>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user