[Test] Add debug names to unnamed test disposables
- This helps to track down disposables which are never disposed, and reduces confusion when printing disposables in general (the names will now be meaningful, instead of endless lists of "newDisposable" and "TestDisposable"). ^KT-64099
This commit is contained in:
committed by
Space Team
parent
bba5447b12
commit
32fe29b8cc
+1
-1
@@ -16,7 +16,7 @@ import java.lang.reflect.Field
|
||||
|
||||
class ApplicationEnvironmentDisposer : TestExecutionListener {
|
||||
companion object {
|
||||
val ROOT_DISPOSABLE: Disposable = Disposer.newDisposable()
|
||||
val ROOT_DISPOSABLE: Disposable = Disposer.newDisposable("${ApplicationEnvironmentDisposer::class.simpleName}.ROOT_DISPOSABLE")
|
||||
}
|
||||
|
||||
override fun testPlanExecutionFinished(testPlan: TestPlan) {
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class TestConfigurationImpl(
|
||||
|
||||
val originalBuilder: TestConfigurationBuilder.ReadOnlyBuilder
|
||||
) : TestConfiguration(), TestService {
|
||||
override val rootDisposable: Disposable = TestDisposable()
|
||||
override val rootDisposable: Disposable = TestDisposable("${TestConfigurationImpl::class.simpleName}.rootDisposable")
|
||||
override val testServices: TestServices = TestServices()
|
||||
|
||||
init {
|
||||
|
||||
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.test.utils
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
|
||||
class TestDisposable : Disposable {
|
||||
class TestDisposable(val debugName: String) : Disposable {
|
||||
@Volatile
|
||||
var isDisposed = false
|
||||
private set
|
||||
@@ -15,4 +15,6 @@ class TestDisposable : Disposable {
|
||||
override fun dispose() {
|
||||
isDisposed = true
|
||||
}
|
||||
|
||||
override fun toString(): String = debugName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user