From 6740a712d88781ef63804e77714c1fd80c2bdc1d Mon Sep 17 00:00:00 2001 From: "Natalia.Ukhorskaya" Date: Wed, 22 Aug 2012 13:54:38 +0400 Subject: [PATCH] Move blackBoxWithJavaFile from FunctionGenTest to CodegenTestCase --- .../jet/codegen/CodegenTestCase.java | 15 ++++++++++ .../jet/codegen/FunctionGenTest.java | 30 +++++-------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java b/compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java index 0bd14f211dc..0c555fb00e6 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java +++ b/compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java @@ -25,7 +25,9 @@ import com.intellij.psi.PsiFile; import com.intellij.testFramework.UsefulTestCase; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.CompileCompilerDependenciesTest; import org.jetbrains.jet.ConfigurationKind; +import org.jetbrains.jet.TestJdkKind; import org.jetbrains.jet.cli.jvm.JVMConfigurationKeys; import org.jetbrains.jet.lang.BuiltinsScopeExtensionMode; import org.jetbrains.jet.lang.resolve.ScriptNameUtil; @@ -260,6 +262,19 @@ public abstract class CodegenTestCase extends UsefulTestCase { } } + protected 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); + + myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), CompileCompilerDependenciesTest.compilerConfigurationForTests( + ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory)); + + blackBoxFile(ktFile); + } + protected GeneratedClassLoader createClassLoader(ClassFileFactory codegens) { List urls = Lists.newArrayList(); for (File file : myEnvironment.getConfiguration().getList(JVMConfigurationKeys.CLASSPATH_KEY)) { diff --git a/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java index 846a3edef86..4f3aa6d49a1 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java @@ -163,30 +163,16 @@ public class FunctionGenTest extends CodegenTestCase { blackBoxFile("regressions/kt1038.kt"); } - 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); - myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), CompileCompilerDependenciesTest.compilerConfigurationForTests( - ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory)); + public void testReferencesStaticInnerClassMethod() throws Exception { + blackBoxFileWithJava("functions/referencesStaticInnerClassMethod.kt"); + } - blackBoxFile(ktFile); - } + 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"); - } - - public void testRemoveInIterator() throws Exception { - blackBoxFileWithJava("functions/removeInIterator.kt"); - } + public void testRemoveInIterator() throws Exception { + blackBoxFileWithJava("functions/removeInIterator.kt"); } }