Clean up test data after end of the test
This commit is contained in:
@@ -62,9 +62,19 @@ public class CheckLocalVariablesTableTest extends TestCaseWithTmpdir {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
jetCoreEnvironment = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
jetCoreEnvironment = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
String text = FileUtil.loadFile(ktFile);
|
||||
|
||||
JetFile psiFile = JetTestUtils.createFile(ktFile.getName(), text, jetCoreEnvironment.getProject());
|
||||
|
||||
@@ -50,6 +50,12 @@ public abstract class AbstractWriteFlagsTest extends UsefulTestCase {
|
||||
jetCoreEnvironment = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable, ConfigurationKind.JDK_ONLY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
jetCoreEnvironment = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
protected void doTest(String path) throws IOException {
|
||||
File ktFile = new File(path);
|
||||
assertTrue("Cannot find a file " + ktFile.getAbsolutePath(), ktFile.exists());
|
||||
|
||||
@@ -66,6 +66,12 @@ public abstract class AbstractJavaResolverDescriptorTest extends TestCaseWithTmp
|
||||
setUpJavaDescriptorResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
javaDescriptorResolver = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private void setUpJavaDescriptorResolver() {
|
||||
JetCoreEnvironment jetCoreEnvironment =
|
||||
new JetCoreEnvironment(myTestRootDisposable, CompileCompilerDependenciesTest.compilerConfigurationForTests(
|
||||
|
||||
@@ -71,6 +71,13 @@ public class JdkAnnotationsSanityTest extends KotlinTestWithEnvironment {
|
||||
ideaAnnotationsRoot = VirtualFileManager.getInstance().findFileByUrl("jar://ideaSDK/lib/jdkAnnotations.jar!/");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
ideaAnnotationsRoot = null;
|
||||
kotlinAnnotationsRoot = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testNoErrorsInAlternativeSignatures() {
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(getProject());
|
||||
|
||||
|
||||
@@ -72,9 +72,19 @@ public class WriteSignatureTest extends TestCaseWithTmpdir {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
jetCoreEnvironment = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
jetCoreEnvironment = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
String text = FileUtil.loadFile(ktFile);
|
||||
|
||||
JetFile psiFile = JetTestUtils.createFile(ktFile.getName(), text, jetCoreEnvironment.getProject());
|
||||
|
||||
@@ -55,6 +55,12 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
tc.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
tc.tearDown();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public class JetDefaultModalityModifiersTestCase {
|
||||
private ModuleDescriptor root = new ModuleDescriptor(Name.special("<test_root>"));
|
||||
private DescriptorResolver descriptorResolver;
|
||||
@@ -67,6 +73,11 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
scope = createScope(builtIns.getBuiltInsScope());
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
scope = null;
|
||||
descriptorResolver = null;
|
||||
}
|
||||
|
||||
private JetScope createScope(JetScope libraryScope) {
|
||||
JetFile file = JetPsiFactory.createFile(getProject(), "abstract class C { abstract fun foo(); abstract val a: Int }");
|
||||
List<JetDeclaration> declarations = file.getDeclarations();
|
||||
|
||||
@@ -53,6 +53,13 @@ public class JetOverloadTest extends JetLiteFixture {
|
||||
descriptorResolver = injector.getDescriptorResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
builtIns = null;
|
||||
descriptorResolver = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JetTestCaseBuilder.getTestDataPathBase();
|
||||
@@ -180,5 +187,4 @@ public class JetOverloadTest extends JetLiteFixture {
|
||||
JetNamedFunction function = JetPsiFactory.createFunction(getProject(), funDecl);
|
||||
return descriptorResolver.resolveFunctionDescriptor(root, builtIns.getBuiltInsScope(), function, JetTestUtils.DUMMY_TRACE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,13 @@ public class JetOverridingTest extends JetLiteFixture {
|
||||
descriptorResolver = injector.getDescriptorResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
builtIns = null;
|
||||
descriptorResolver = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JetTestCaseBuilder.getTestDataPathBase();
|
||||
|
||||
@@ -90,6 +90,19 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
||||
scopeWithImports = getDeclarationsScope("compiler/testData/type-checker-test.kt");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
scopeWithImports = null;
|
||||
|
||||
expressionTypingServices = null;
|
||||
typeResolver = null;
|
||||
descriptorResolver = null;
|
||||
|
||||
builtIns = null;
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JetTestCaseBuilder.getTestDataPathBase();
|
||||
|
||||
@@ -70,6 +70,13 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
|
||||
scope = getContextScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
injector = null;
|
||||
scope = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private JetScope getContextScope() throws IOException {
|
||||
// todo comments
|
||||
String text = FileUtil.loadFile(new File("compiler/testData/type-substitutor.kt"));
|
||||
|
||||
Reference in New Issue
Block a user