Check that removing open brace is out-of-block change
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
// TRUE
|
||||||
|
fun test() {<caret>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// TYPE: \b
|
||||||
+10
-1
@@ -17,10 +17,12 @@
|
|||||||
package org.jetbrains.jet.plugin.codeInsight;
|
package org.jetbrains.jet.plugin.codeInsight;
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import com.intellij.psi.PsiDocumentManager;
|
import com.intellij.psi.PsiDocumentManager;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.PsiManager;
|
import com.intellij.psi.PsiManager;
|
||||||
import com.intellij.psi.impl.PsiModificationTrackerImpl;
|
import com.intellij.psi.impl.PsiModificationTrackerImpl;
|
||||||
|
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ public abstract class AbstractOutOfBlockModificationTest extends JetLightCodeIns
|
|||||||
long oobBeforeType = tracker.getOutOfCodeBlockModificationCount();
|
long oobBeforeType = tracker.getOutOfCodeBlockModificationCount();
|
||||||
long modificationCountBeforeType = tracker.getModificationCount();
|
long modificationCountBeforeType = tracker.getModificationCount();
|
||||||
|
|
||||||
myFixture.type('a');
|
myFixture.type(getStringToType());
|
||||||
PsiDocumentManager.getInstance(myFixture.getProject()).commitDocument(myFixture.getDocument(myFixture.getFile()));
|
PsiDocumentManager.getInstance(myFixture.getProject()).commitDocument(myFixture.getDocument(myFixture.getFile()));
|
||||||
|
|
||||||
long oobAfterCount = tracker.getOutOfCodeBlockModificationCount();
|
long oobAfterCount = tracker.getOutOfCodeBlockModificationCount();
|
||||||
@@ -65,6 +67,13 @@ public abstract class AbstractOutOfBlockModificationTest extends JetLightCodeIns
|
|||||||
expectedOutOfBlock, oobBeforeType != oobAfterCount);
|
expectedOutOfBlock, oobBeforeType != oobAfterCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getStringToType() {
|
||||||
|
String text = myFixture.getDocument(myFixture.getFile()).getText();
|
||||||
|
String typeDirectives = InTextDirectivesUtils.findStringWithPrefixes(text, "TYPE:");
|
||||||
|
|
||||||
|
return typeDirectives != null ? StringUtil.unescapeStringCharacters(typeDirectives) : "a";
|
||||||
|
}
|
||||||
|
|
||||||
private boolean getExpectedOutOfBlockResult() {
|
private boolean getExpectedOutOfBlockResult() {
|
||||||
String text = myFixture.getDocument(myFixture.getFile()).getText();
|
String text = myFixture.getDocument(myFixture.getFile()).getText();
|
||||||
|
|
||||||
|
|||||||
+6
@@ -60,6 +60,12 @@ public class OutOfBlockModificationTestGenerated extends AbstractOutOfBlockModif
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("FunNoType_Block.kt")
|
||||||
|
public void testFunNoType_Block() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/outOfBlock/FunNoType_Block.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("FunNoType_Block_Class.kt")
|
@TestMetadata("FunNoType_Block_Class.kt")
|
||||||
public void testFunNoType_Block_Class() throws Exception {
|
public void testFunNoType_Block_Class() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/outOfBlock/FunNoType_Block_Class.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/outOfBlock/FunNoType_Block_Class.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user