Better memory cleanup in tests

This commit is contained in:
Andrey Breslav
2014-04-28 13:56:35 +04:00
parent 68c77e6384
commit 4f1061c337
2 changed files with 17 additions and 10 deletions
@@ -41,8 +41,13 @@ abstract public class AbstractConstraintSystemTest() : JetLiteFixture() {
val constraintPattern = Pattern.compile("""(SUBTYPE|SUPERTYPE)\s+${typePattern}\s+${typePattern}\s+(weak)?""", Pattern.MULTILINE)
val variablesPattern = Pattern.compile("VARIABLES\\s+(.*)")
private var typeResolver: TypeResolver by Delegates.notNull()
private var myDeclarations: MyDeclarations by Delegates.notNull()
private var _typeResolver: TypeResolver? = null
private val typeResolver: TypeResolver
get() = _typeResolver!!
private var _myDeclarations: MyDeclarations? = null
private val myDeclarations: MyDeclarations
get() = _myDeclarations!!
override fun createEnvironment(): JetCoreEnvironment {
return createEnvironmentWithMockJdk(ConfigurationKind.ALL)
@@ -52,8 +57,14 @@ abstract public class AbstractConstraintSystemTest() : JetLiteFixture() {
super.setUp()
val injector = InjectorForTests(getProject(), JetTestUtils.createEmptyModule()!!)
typeResolver = injector.getTypeResolver()!!
myDeclarations = analyzeDeclarations()
_typeResolver = injector.getTypeResolver()!!
_myDeclarations = analyzeDeclarations()
}
override fun tearDown() {
_typeResolver = null
_myDeclarations = null
super<JetLiteFixture>.tearDown()
}
override fun getTestDataPath(): String {
@@ -38,12 +38,8 @@ public abstract class CompletionHandlerTestBase() : JetLightCodeInsightFixtureTe
protected abstract val completionType : CompletionType
protected abstract val testDataRelativePath: String
protected var fixture: JavaCodeInsightTestFixture by Delegates.notNull<JavaCodeInsightTestFixture>()
protected override fun setUp() {
super.setUp()
fixture = myFixture
}
protected val fixture: JavaCodeInsightTestFixture
get() = myFixture
protected fun doTest() : Unit = doTest(2, null, null, null, '\n')