Use real kotlin-stdlib jar in addKotlinReflect configuration test
The presence of "Add kotlin-reflect.jar..." action depends on whether the API that requires full kotlin-reflect is actually resolved. Since builtins now do not contain the entire JVM reflect API, but rather the common one, we need a real kotlin-stdlib instead of dummy one to have 'KProperty1.getter' symbol resolved.
This commit is contained in:
@@ -30,6 +30,8 @@ import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
|||||||
import org.jetbrains.kotlin.idea.test.configureKotlinFacet
|
import org.jetbrains.kotlin.idea.test.configureKotlinFacet
|
||||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
||||||
|
import org.jetbrains.kotlin.utils.KotlinPaths
|
||||||
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@@ -166,7 +168,7 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testAddKotlinReflect() {
|
fun testAddKotlinReflect() {
|
||||||
configureRuntime("mockRuntime11")
|
configureRuntime("actualRuntime")
|
||||||
myFixture.configureByText(
|
myFixture.configureByText(
|
||||||
"foo.kt", """class Foo(val prop: Any) {
|
"foo.kt", """class Foo(val prop: Any) {
|
||||||
fun func() {}
|
fun func() {}
|
||||||
@@ -185,8 +187,12 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
|
|
||||||
private fun configureRuntime(path: String) {
|
private fun configureRuntime(path: String) {
|
||||||
val name = if (path == "mockRuntime106") "kotlin-runtime.jar" else "kotlin-stdlib.jar"
|
val name = if (path == "mockRuntime106") "kotlin-runtime.jar" else "kotlin-stdlib.jar"
|
||||||
|
val sourcePath = when (path) {
|
||||||
|
"actualRuntime" -> PathUtil.kotlinPathsForIdeaPlugin.jar(KotlinPaths.Jar.StdLib)
|
||||||
|
else -> File("idea/testData/configuration/$path/$name")
|
||||||
|
}
|
||||||
val tempFile = File(FileUtil.createTempDirectory("kotlin-update-configuration", null), name)
|
val tempFile = File(FileUtil.createTempDirectory("kotlin-update-configuration", null), name)
|
||||||
FileUtil.copy(File("idea/testData/configuration/$path/$name"), tempFile)
|
FileUtil.copy(sourcePath, tempFile)
|
||||||
val tempVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempFile) ?: error("Can't find file: $tempFile")
|
val tempVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempFile) ?: error("Can't find file: $tempFile")
|
||||||
|
|
||||||
updateModel(myFixture.module) { model ->
|
updateModel(myFixture.module) { model ->
|
||||||
|
|||||||
+8
-2
@@ -30,6 +30,8 @@ import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
|||||||
import org.jetbrains.kotlin.idea.test.configureKotlinFacet
|
import org.jetbrains.kotlin.idea.test.configureKotlinFacet
|
||||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
||||||
|
import org.jetbrains.kotlin.utils.KotlinPaths
|
||||||
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@@ -169,7 +171,7 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testAddKotlinReflect() {
|
fun testAddKotlinReflect() {
|
||||||
configureRuntime("mockRuntime11")
|
configureRuntime("actualRuntime")
|
||||||
myFixture.configureByText(
|
myFixture.configureByText(
|
||||||
"foo.kt", """class Foo(val prop: Any) {
|
"foo.kt", """class Foo(val prop: Any) {
|
||||||
fun func() {}
|
fun func() {}
|
||||||
@@ -188,8 +190,12 @@ class UpdateConfigurationQuickFixTest : LightPlatformCodeInsightFixtureTestCase(
|
|||||||
|
|
||||||
private fun configureRuntime(path: String) {
|
private fun configureRuntime(path: String) {
|
||||||
val name = if (path == "mockRuntime106") "kotlin-runtime.jar" else "kotlin-stdlib.jar"
|
val name = if (path == "mockRuntime106") "kotlin-runtime.jar" else "kotlin-stdlib.jar"
|
||||||
|
val sourcePath = when (path) {
|
||||||
|
"actualRuntime" -> PathUtil.kotlinPathsForIdeaPlugin.jar(KotlinPaths.Jar.StdLib)
|
||||||
|
else -> File("idea/testData/configuration/$path/$name")
|
||||||
|
}
|
||||||
val tempFile = File(FileUtil.createTempDirectory("kotlin-update-configuration", null), name)
|
val tempFile = File(FileUtil.createTempDirectory("kotlin-update-configuration", null), name)
|
||||||
FileUtil.copy(File("idea/testData/configuration/$path/$name"), tempFile)
|
FileUtil.copy(sourcePath, tempFile)
|
||||||
val tempVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempFile) ?: error("Can't find file: $tempFile")
|
val tempVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempFile) ?: error("Can't find file: $tempFile")
|
||||||
|
|
||||||
updateModel(myFixture.module) { model ->
|
updateModel(myFixture.module) { model ->
|
||||||
|
|||||||
Reference in New Issue
Block a user