[Kotlin] Use test disposable for cleaning test registry value

KTIJ-29725

GitOrigin-RevId: 1ede31b498132da569b45f77bc618f0e03abe996
This commit is contained in:
Pavel Kirpichenkov
2024-05-27 11:51:18 +00:00
committed by intellij-monorepo-bot
parent 0dad9dd658
commit fdca03869d
2 changed files with 4 additions and 9 deletions
@@ -61,17 +61,12 @@ abstract class KotlinLightMultiplatformCodeInsightFixtureTestCase : KotlinLightC
return TestProjectFiles(allFiles, mainFile)
}
private var isKotlinK2KmpEnabledBeforeTest: Boolean? = null
override fun setUp() {
super.setUp()
Registry.get("kotlin.k2.kmp.enabled").let { registryValue ->
isKotlinK2KmpEnabledBeforeTest = registryValue.asBoolean()
registryValue.setValue(true)
}
Registry.get("kotlin.k2.kmp.enabled").setValue(true, testRootDisposable)
// sync is necessary for to detect unexpected disappearances of library files
// sync is necessary to detect unexpected disappearances of library files
VfsTestUtil.syncRefresh()
}
@@ -79,7 +74,6 @@ abstract class KotlinLightMultiplatformCodeInsightFixtureTestCase : KotlinLightC
runAll(
{ KotlinMultiPlatformProjectDescriptor.cleanupSourceRoots() },
{ KotlinSdkType.removeKotlinSdkInTests() },
{ Registry.get("kotlin.k2.kmp.enabled").setValue(isKotlinK2KmpEnabledBeforeTest == true) },
{ super.tearDown() },
)
}
@@ -28,12 +28,13 @@ import org.jetbrains.kotlin.platform.konan.NativePlatforms
/**
* The project is created with the following module structure:
* ```
* Common --- Js
* \--- Jvm
* \--- Native --- MinGW
* \--- Linux --- LinuxX64
* \--- LinuxArm64
*
* ```
* Standard library and kotlinx-coroutines-core of fixed versions are added to all modules.
*
* Apple targets require a Mac host and therefore are not included in the test project.