[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:
Marco Pennekamp
2023-12-05 20:40:50 +01:00
committed by Space Team
parent bba5447b12
commit 32fe29b8cc
33 changed files with 57 additions and 34 deletions
@@ -199,7 +199,7 @@ internal class TestRepl(
) : Closeable {
val application = ApplicationManager.getApplication()
private val disposable: Disposable by lazy { Disposer.newDisposable() }
private val disposable: Disposable by lazy { Disposer.newDisposable("${TestRepl::class.simpleName}.disposable") }
val emptyScriptArgs = ScriptArgsWithTypes(arrayOf(emptyArray<String>()), arrayOf(Array<String>::class))
@@ -23,7 +23,7 @@ class FastJarFSTest : TestCase() {
private var fs: FastJarFileSystem? = null
private var coreAppEnv: JavaCoreApplicationEnvironment? = null
private val rootDisposable = Disposer.newDisposable()
private val rootDisposable = Disposer.newDisposable("${FastJarFSTest::class.simpleName}.rootDisposable")
override fun setUp() {
super.setUp()
@@ -72,7 +72,7 @@ class KotlinJavascriptSerializerTest : TestCaseWithTmpdir() {
}
private fun serialize(configuration: CompilerConfiguration, metaFile: File) {
val rootDisposable = Disposer.newDisposable()
val rootDisposable = Disposer.newDisposable("Disposable for ${KotlinJavascriptSerializerTest::class.simpleName}.serialize")
try {
val environment = KotlinCoreEnvironment.createForTests(rootDisposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES)
val files = environment.getSourceFiles()