Remove BeforeExtractFunctionInsertionTest, the new evaluator doesn't depend on the 'extract function' refactoring

This commit is contained in:
Yan Zhulanow
2019-01-30 02:30:46 +03:00
parent 0657a3d399
commit 300c102c3f
17 changed files with 0 additions and 181 deletions
@@ -1,5 +0,0 @@
package foo
fun main(args: Array<String>) {
<caret>println()
}
@@ -1,6 +0,0 @@
package foo
fun main(args: Array<String>) {
1 + 1
println()
}
@@ -1 +0,0 @@
1 + 1
@@ -1,5 +0,0 @@
package foo
fun main(args: Array<String>) {
<caret>println()
}
@@ -1,8 +0,0 @@
package foo
import foo
fun main(args: Array<String>) {
1 + 1
println()
}
@@ -1,3 +0,0 @@
import foo
1 + 1
@@ -1,3 +0,0 @@
fun main(args: Array<String>) {
<caret>println()
}
@@ -1,4 +0,0 @@
fun main(args: Array<String>) {
1 + 1
println()
}
@@ -1,3 +0,0 @@
fun main(args: Array<String>) {
<caret>println()
}
@@ -1,6 +0,0 @@
import foo.*
fun main(args: Array<String>) {
1 + 1
println()
}
@@ -1,3 +0,0 @@
import foo.*
1 + 1
@@ -1,8 +0,0 @@
package foo
import a
import b
fun main(args: Array<String>) {
<caret>println()
}
@@ -1,12 +0,0 @@
package foo
import a
import b
import a
import b
fun main(args: Array<String>) {
1 + 1
println()
}
@@ -1,4 +0,0 @@
import a
import b
1 + 1
@@ -1,53 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.debugger
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.util.io.FileUtil
import com.intellij.testFramework.LightCodeInsightTestCase
import com.intellij.testFramework.LightPlatformCodeInsightTestCase
import org.jetbrains.kotlin.idea.refactoring.getLineNumber
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinCodeFragmentFactory
import org.jetbrains.kotlin.idea.debugger.evaluate.addDebugExpressionIntoTmpFileForExtractFunction
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtExpressionCodeFragment
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
import java.util.concurrent.Callable
abstract class AbstractBeforeExtractFunctionInsertionTest : LightCodeInsightTestCase() {
fun doTest(path: String) {
configureByFile(path)
val offset = LightPlatformCodeInsightTestCase.getEditor().caretModel.offset
val elementAt = KotlinCodeFragmentFactory.getContextElement(myFile.findElementAt(offset)) ?: throw AssertionError()
val line = elementAt.getLineNumber()
val fragmentFile = KotlinTestUtils.createFile("${myFile.name}fragment.kt", FileUtil.loadFile(File(path + ".fragment"), true), getProject())
val imports = fragmentFile.importList?.text ?: ""
val allText = fragmentFile.text
val fragmentText = if (imports.isBlank()) allText else allText.substringAfter(imports, allText)
val expressionList = ApplicationManager.getApplication().executeOnPooledThread(Callable<List<KtExpression>> {
runReadAction {
addDebugExpressionIntoTmpFileForExtractFunction(
myFile as KtFile,
KtExpressionCodeFragment(getProject(), "fragment.kt", fragmentText, imports, elementAt),
line)
}
}).get()
KotlinTestUtils.assertEqualsToFile(File(path + ".after"), expressionList.first().containingFile.text)
}
override fun getTestDataPath(): String {
return ""
}
}
@@ -1,56 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.debugger;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("idea/testData/debugger/insertBeforeExtractFunction")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class BeforeExtractFunctionInsertionTestGenerated extends AbstractBeforeExtractFunctionInsertionTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInInsertBeforeExtractFunction() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/insertBeforeExtractFunction"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("emptyImportDirective.kt")
public void testEmptyImportDirective() throws Exception {
runTest("idea/testData/debugger/insertBeforeExtractFunction/emptyImportDirective.kt");
}
@TestMetadata("emptyImportDirective2.kt")
public void testEmptyImportDirective2() throws Exception {
runTest("idea/testData/debugger/insertBeforeExtractFunction/emptyImportDirective2.kt");
}
@TestMetadata("emptyPackageDirective.kt")
public void testEmptyPackageDirective() throws Exception {
runTest("idea/testData/debugger/insertBeforeExtractFunction/emptyPackageDirective.kt");
}
@TestMetadata("emptyPackageDirective2.kt")
public void testEmptyPackageDirective2() throws Exception {
runTest("idea/testData/debugger/insertBeforeExtractFunction/emptyPackageDirective2.kt");
}
@TestMetadata("manyImports.kt")
public void testManyImports() throws Exception {
runTest("idea/testData/debugger/insertBeforeExtractFunction/manyImports.kt");
}
}