Don't mess up with configuring project descriptors in PullPush tests
This commit fixes tests in 173 branch.
This commit is contained in:
@@ -21,7 +21,7 @@ abstract class A {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
@JvmStatic
|
@kotlin.jvm.JvmStatic
|
||||||
fun foo2(n: Int): String {
|
fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ abstract class A {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||||
@JvmStatic
|
@kotlin.jvm.JvmStatic
|
||||||
fun foo2(n: Int): String {
|
fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interface A {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
@JvmStatic
|
@kotlin.jvm.JvmStatic
|
||||||
fun foo2(n: Int): String {
|
fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class T {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
@JvmStatic
|
@kotlin.jvm.JvmStatic
|
||||||
fun foo2(n: Int): String {
|
fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
abstract class <caret>B(
|
abstract class <caret>B(
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
val n: Int,
|
val n: Int,
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
val s: String,
|
val s: String,
|
||||||
val b: Boolean
|
val b: Boolean
|
||||||
): A()
|
): A()
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
abstract class B(
|
abstract class B(
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
val b: Boolean
|
val b: Boolean
|
||||||
): A()
|
): A()
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.refactoring
|
|||||||
import com.google.gson.JsonParser
|
import com.google.gson.JsonParser
|
||||||
import com.intellij.openapi.util.Key
|
import com.intellij.openapi.util.Key
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.refactoring.BaseRefactoringProcessor
|
import com.intellij.refactoring.BaseRefactoringProcessor
|
||||||
@@ -26,23 +27,15 @@ import com.intellij.refactoring.classMembers.MemberInfoBase
|
|||||||
import com.intellij.refactoring.util.CommonRefactoringUtil
|
import com.intellij.refactoring.util.CommonRefactoringUtil
|
||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
||||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.KtPsiClassWrapper
|
import org.jetbrains.kotlin.idea.refactoring.memberInfo.KtPsiClassWrapper
|
||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
|
||||||
import org.jetbrains.kotlin.psi.NotNullableUserDataProperty
|
import org.jetbrains.kotlin.psi.NotNullableUserDataProperty
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.jetbrains.kotlin.test.util.findElementsByCommentPrefix
|
import org.jetbrains.kotlin.test.util.findElementsByCommentPrefix
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
abstract class AbstractMemberPullPushTest : KotlinLightCodeInsightFixtureTestCase() {
|
abstract class AbstractMemberPullPushTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
|
||||||
|
|
||||||
val fixture: JavaCodeInsightTestFixture get() = myFixture
|
val fixture: JavaCodeInsightTestFixture get() = myFixture
|
||||||
|
|
||||||
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase()
|
|
||||||
|
|
||||||
protected fun doTest(path: String, action: (mainFile: PsiFile) -> Unit) {
|
protected fun doTest(path: String, action: (mainFile: PsiFile) -> Unit) {
|
||||||
val mainFile = File(path)
|
val mainFile = File(path)
|
||||||
val afterFile = File("$path.after")
|
val afterFile = File("$path.after")
|
||||||
@@ -58,11 +51,6 @@ abstract class AbstractMemberPullPushTest : KotlinLightCodeInsightFixtureTestCas
|
|||||||
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(it.name) }
|
val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(it.name) }
|
||||||
val file = fixture.configureByFile(mainFileName)
|
val file = fixture.configureByFile(mainFileName)
|
||||||
|
|
||||||
val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(file.text, "// WITH_RUNTIME") != null
|
|
||||||
if (addKotlinRuntime) {
|
|
||||||
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
markMembersInfo(file)
|
markMembersInfo(file)
|
||||||
extraFilesToPsi.keys.forEach(::markMembersInfo)
|
extraFilesToPsi.keys.forEach(::markMembersInfo)
|
||||||
@@ -70,6 +58,9 @@ abstract class AbstractMemberPullPushTest : KotlinLightCodeInsightFixtureTestCas
|
|||||||
action(file)
|
action(file)
|
||||||
|
|
||||||
assert(!conflictFile.exists()) { "Conflict file $conflictFile should not exist" }
|
assert(!conflictFile.exists()) { "Conflict file $conflictFile should not exist" }
|
||||||
|
|
||||||
|
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||||
|
|
||||||
KotlinTestUtils.assertEqualsToFile(afterFile, file.text!!)
|
KotlinTestUtils.assertEqualsToFile(afterFile, file.text!!)
|
||||||
for ((extraPsiFile, extraFile) in extraFilesToPsi) {
|
for ((extraPsiFile, extraFile) in extraFilesToPsi) {
|
||||||
KotlinTestUtils.assertEqualsToFile(File("${extraFile.path}.after"), extraPsiFile.text)
|
KotlinTestUtils.assertEqualsToFile(File("${extraFile.path}.after"), extraPsiFile.text)
|
||||||
@@ -83,14 +74,7 @@ abstract class AbstractMemberPullPushTest : KotlinLightCodeInsightFixtureTestCas
|
|||||||
}
|
}
|
||||||
KotlinTestUtils.assertEqualsToFile(conflictFile, message)
|
KotlinTestUtils.assertEqualsToFile(conflictFile, message)
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
if (addKotlinRuntime) {
|
|
||||||
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun markMembersInfo(file: PsiFile) {
|
internal fun markMembersInfo(file: PsiFile) {
|
||||||
|
|||||||
Reference in New Issue
Block a user