mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SIOOBE (PY-4455)
This commit is contained in:
@@ -83,6 +83,9 @@ public class PyRefactoringUtil {
|
||||
}
|
||||
final String parentText = parent.getText();
|
||||
final int startOffset = element1.getTextOffset() - parent.getTextOffset() - 1;
|
||||
if (startOffset < 0) {
|
||||
return null;
|
||||
}
|
||||
final int endOffset = element2.getTextOffset() + element2.getTextLength() - parent.getTextOffset();
|
||||
|
||||
final String prefix = parentText.substring(0, startOffset);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
a = <selection>b + fu</selection>nc()
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jetbrains.python.refactoring;
|
||||
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import com.jetbrains.python.psi.PyCallExpression;
|
||||
import com.jetbrains.python.psi.PyExpression;
|
||||
@@ -42,6 +43,19 @@ public class PyIntroduceVariableTest extends PyIntroduceTestCase {
|
||||
public void testSuggestStringConstantValue() { // PY-1276
|
||||
doTestSuggestions(PyExpression.class, "foo_bar");
|
||||
}
|
||||
|
||||
public void testIncorrectSelection() { // PY-4455
|
||||
boolean thrownExpectedException = false;
|
||||
try {
|
||||
doTest();
|
||||
}
|
||||
catch (CommonRefactoringUtil.RefactoringErrorHintException e) {
|
||||
if (e.getMessage().equals("Cannot perform refactoring using selected element(s)")) {
|
||||
thrownExpectedException = true;
|
||||
}
|
||||
}
|
||||
assertTrue(thrownExpectedException);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
|
||||
Reference in New Issue
Block a user