Got rid of post-init adding classpath in all tests.

This commit is contained in:
Evgeny Gerashchenko
2012-07-23 16:35:55 +04:00
parent 044b6bf435
commit 7f12dcbc24
12 changed files with 77 additions and 69 deletions
@@ -18,8 +18,11 @@ package org.jetbrains.jet.codegen;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.CompileCompilerDependenciesTest;
import org.jetbrains.jet.ConfigurationKind;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.TestJdkKind;
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
@@ -118,24 +121,26 @@ public class FunctionGenTest extends CodegenTestCase {
blackBoxFile("functions/invoke.kt");
}
private void blackBoxFileWithJava(@NotNull String ktFile) throws Exception {
File javaClassesTempDirectory = new File(FileUtil.getTempDirectory(), "java-classes");
JetTestUtils.mkdirs(javaClassesTempDirectory);
JetTestUtils.compileJavaFile(
new File("compiler/testData/codegen/" + ktFile.replaceFirst("\\.kt$", ".java")),
javaClassesTempDirectory);
public static class WithJavaFunctionGenTest extends CodegenTestCase {
private void blackBoxFileWithJava(@NotNull String ktFile) throws Exception {
File javaClassesTempDirectory = new File(FileUtil.getTempDirectory(), "java-classes");
JetTestUtils.mkdirs(javaClassesTempDirectory);
JetTestUtils.compileJavaFile(
new File("compiler/testData/codegen/" + ktFile.replaceFirst("\\.kt$", ".java")),
javaClassesTempDirectory);
addToClasspath(javaClassesTempDirectory);
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), CompileCompilerDependenciesTest.compilerConfigurationForTests(
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory));
blackBoxFile(ktFile);
blackBoxFile(ktFile);
}
public void testReferencesStaticInnerClassMethod() throws Exception {
blackBoxFileWithJava("functions/referencesStaticInnerClassMethod.kt");
}
public void testReferencesStaticInnerClassMethodTwoLevels() throws Exception {
blackBoxFileWithJava("functions/referencesStaticInnerClassMethodL2.kt");
}
}
public void testReferencesStaticInnerClassMethod() throws Exception {
blackBoxFileWithJava("functions/referencesStaticInnerClassMethod.kt");
}
public void testReferencesStaticInnerClassMethodTwoLevels() throws Exception {
blackBoxFileWithJava("functions/referencesStaticInnerClassMethodL2.kt");
}
}