Remove temp directories in tests

There's new algo for temp file creation that starting to fail after ~1000 files have been created.
This commit is contained in:
Nikolay Krasko
2016-03-18 12:32:11 +03:00
parent 835c8f2c10
commit ed6aaa1138
2 changed files with 9 additions and 0 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.checkers;
import com.intellij.openapi.util.io.FileUtil;
import kotlin.collections.CollectionsKt;
import kotlin.io.FilesKt;
import kotlin.text.Charsets;
@@ -70,6 +71,12 @@ public abstract class KotlinMultiFileTestWithJava<M, F> extends KotlinTestWithEn
return KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, getEnvironmentConfigFiles());
}
@Override
protected void removeEnvironment() throws Exception {
if (javaFilesDir != null) FileUtil.delete(javaFilesDir);
if (kotlinSourceRoot != null) FileUtil.delete(kotlinSourceRoot);
}
@NotNull
protected ConfigurationKind getConfigurationKind() {
return ConfigurationKind.MOCK_RUNTIME;
@@ -31,11 +31,13 @@ public abstract class KotlinTestWithEnvironment extends KotlinTestWithEnvironmen
@Override
protected void tearDown() throws Exception {
removeEnvironment();
environment = null;
super.tearDown();
}
protected abstract KotlinCoreEnvironment createEnvironment() throws Exception;
protected void removeEnvironment() throws Exception {}
@NotNull
public KotlinCoreEnvironment getEnvironment() {