diff --git a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/CodegenTestsOnAndroidGenerator.java b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/CodegenTestsOnAndroidGenerator.java index cfc5c897e97..ef313cbbebd 100644 --- a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/CodegenTestsOnAndroidGenerator.java +++ b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/CodegenTestsOnAndroidGenerator.java @@ -21,11 +21,14 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.testFramework.UsefulTestCase; import junit.framework.Assert; +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.CompileEnvironmentUtil; import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment; -import org.jetbrains.jet.codegen.*; +import org.jetbrains.jet.codegen.ClassFileFactory; +import org.jetbrains.jet.codegen.GenerationUtils; import org.jetbrains.jet.compiler.PathManager; import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetPsiFactory; @@ -53,6 +56,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase { private JetCoreEnvironment environmentWithMockJdk = JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable, ConfigurationKind.JDK_ONLY); private JetCoreEnvironment environmentWithFullJdk = JetTestUtils.createEnvironmentWithFullJdk(myTestRootDisposable); + private JetCoreEnvironment environmentWithFullJdkAndJUnit; private final Pattern packagePattern = Pattern.compile("package (.*)"); @@ -64,6 +68,16 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase { private CodegenTestsOnAndroidGenerator(PathManager pathManager) { this.pathManager = pathManager; + + File junitJar = new File("libraries/lib/junit-4.9.jar"); + + if (!junitJar.exists()) { + throw new AssertionError(); + } + + environmentWithFullJdkAndJUnit = new JetCoreEnvironment(myTestRootDisposable, CompileCompilerDependenciesTest.compilerConfigurationForTests( + ConfigurationKind.ALL, TestJdkKind.FULL_JDK, JetTestUtils.getAnnotationsJar(), junitJar)); + } private void generateOutputFiles() throws Throwable { @@ -120,6 +134,7 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase { Assert.assertNotNull("Folder with testData is empty: " + dir.getAbsolutePath(), files); Set excludedFiles = SpecialFiles.getExcludedFiles(); Set filesCompiledWithoutStdLib = SpecialFiles.getFilesCompiledWithoutStdLib(); + Set filesCompiledWithJUnit = SpecialFiles.getFilesCompiledWithJUnit(); for (File file : files) { if (excludedFiles.contains(file.getName())) { continue; @@ -138,6 +153,9 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase { if (filesCompiledWithoutStdLib.contains(file.getName())) { factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithMockJdk); } + else if (filesCompiledWithJUnit.contains(file.getName())) { + factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdkAndJUnit); + } else { factory = getFactoryFromText(file.getAbsolutePath(), text, environmentWithFullJdk); } diff --git a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java index c9934ce954b..dfb7e5f26af 100644 --- a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java +++ b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java @@ -30,10 +30,16 @@ import java.util.Set; public class SpecialFiles { private static final Set excludedFiles = Sets.newHashSet(); private static final Set filesCompiledWithoutStdLib = Sets.newHashSet(); + private static final Set filesCompiledWithJUnit = Sets.newHashSet(); static { fillExcludedFiles(); fillFilesCompiledWithoutStdLib(); + fillFilesCompiledWithJUnit(); + } + + public static Set getFilesCompiledWithJUnit() { + return filesCompiledWithJUnit; } public static Set getExcludedFiles() { @@ -43,6 +49,10 @@ public class SpecialFiles { public static Set getFilesCompiledWithoutStdLib() { return filesCompiledWithoutStdLib; } + + private static void fillFilesCompiledWithJUnit() { + filesCompiledWithJUnit.add("kt2334.kt"); + } private static void fillFilesCompiledWithoutStdLib() { filesCompiledWithoutStdLib.add("kt1953_class.kt"); // Exception in code @@ -90,7 +100,7 @@ public class SpecialFiles { excludedFiles.add("kt1199.kt"); // Bug KT-2202 excludedFiles.add("kt344.jet"); // Bug KT-2251 - excludedFiles.add("kt529.kt"); // Bug + excludedFiles.add("kt529.kt"); // Bug } private SpecialFiles() {