Better memory cleanup in tests
This commit is contained in:
+15
-4
@@ -41,8 +41,13 @@ abstract public class AbstractConstraintSystemTest() : JetLiteFixture() {
|
|||||||
val constraintPattern = Pattern.compile("""(SUBTYPE|SUPERTYPE)\s+${typePattern}\s+${typePattern}\s+(weak)?""", Pattern.MULTILINE)
|
val constraintPattern = Pattern.compile("""(SUBTYPE|SUPERTYPE)\s+${typePattern}\s+${typePattern}\s+(weak)?""", Pattern.MULTILINE)
|
||||||
val variablesPattern = Pattern.compile("VARIABLES\\s+(.*)")
|
val variablesPattern = Pattern.compile("VARIABLES\\s+(.*)")
|
||||||
|
|
||||||
private var typeResolver: TypeResolver by Delegates.notNull()
|
private var _typeResolver: TypeResolver? = null
|
||||||
private var myDeclarations: MyDeclarations by Delegates.notNull()
|
private val typeResolver: TypeResolver
|
||||||
|
get() = _typeResolver!!
|
||||||
|
|
||||||
|
private var _myDeclarations: MyDeclarations? = null
|
||||||
|
private val myDeclarations: MyDeclarations
|
||||||
|
get() = _myDeclarations!!
|
||||||
|
|
||||||
override fun createEnvironment(): JetCoreEnvironment {
|
override fun createEnvironment(): JetCoreEnvironment {
|
||||||
return createEnvironmentWithMockJdk(ConfigurationKind.ALL)
|
return createEnvironmentWithMockJdk(ConfigurationKind.ALL)
|
||||||
@@ -52,8 +57,14 @@ abstract public class AbstractConstraintSystemTest() : JetLiteFixture() {
|
|||||||
super.setUp()
|
super.setUp()
|
||||||
|
|
||||||
val injector = InjectorForTests(getProject(), JetTestUtils.createEmptyModule()!!)
|
val injector = InjectorForTests(getProject(), JetTestUtils.createEmptyModule()!!)
|
||||||
typeResolver = injector.getTypeResolver()!!
|
_typeResolver = injector.getTypeResolver()!!
|
||||||
myDeclarations = analyzeDeclarations()
|
_myDeclarations = analyzeDeclarations()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun tearDown() {
|
||||||
|
_typeResolver = null
|
||||||
|
_myDeclarations = null
|
||||||
|
super<JetLiteFixture>.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTestDataPath(): String {
|
override fun getTestDataPath(): String {
|
||||||
|
|||||||
@@ -38,12 +38,8 @@ public abstract class CompletionHandlerTestBase() : JetLightCodeInsightFixtureTe
|
|||||||
protected abstract val completionType : CompletionType
|
protected abstract val completionType : CompletionType
|
||||||
protected abstract val testDataRelativePath: String
|
protected abstract val testDataRelativePath: String
|
||||||
|
|
||||||
protected var fixture: JavaCodeInsightTestFixture by Delegates.notNull<JavaCodeInsightTestFixture>()
|
protected val fixture: JavaCodeInsightTestFixture
|
||||||
|
get() = myFixture
|
||||||
protected override fun setUp() {
|
|
||||||
super.setUp()
|
|
||||||
fixture = myFixture
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun doTest() : Unit = doTest(2, null, null, null, '\n')
|
protected fun doTest() : Unit = doTest(2, null, null, null, '\n')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user