[Jspecify] Move diagnostic tests against compiled java under the new tests infrastructure
This commit is contained in:
-39
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.checkers
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
|
|
||||||
import org.jetbrains.kotlin.test.MockLibraryUtilExt.compileJavaFilesLibraryToJar
|
|
||||||
import java.io.File
|
|
||||||
import kotlin.io.path.ExperimentalPathApi
|
|
||||||
import kotlin.io.path.createTempDirectory
|
|
||||||
|
|
||||||
@OptIn(ObsoleteTestInfrastructure::class)
|
|
||||||
abstract class AbstractForeignAnnotationsCompiledJavaDiagnosticTest : AbstractDiagnosticsTest() {
|
|
||||||
@OptIn(ExperimentalPathApi::class)
|
|
||||||
override fun doMultiFileTest(
|
|
||||||
wholeFile: File,
|
|
||||||
files: List<TestFile>
|
|
||||||
) {
|
|
||||||
val ktFiles = files.filter { !it.name.endsWith(".java") }
|
|
||||||
val javaFile = File("${wholeFile.parentFile.path}/${wholeFile.nameWithoutExtension}.java")
|
|
||||||
|
|
||||||
assertExists(javaFile)
|
|
||||||
|
|
||||||
val javaFilesDir = createTempDirectory().toFile().also {
|
|
||||||
File(FOREIGN_JDK8_ANNOTATIONS_SOURCES_PATH).copyRecursively(File("$it/annotations/"))
|
|
||||||
javaFile.copyTo(File("$it/${javaFile.name}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
super.doMultiFileTest(
|
|
||||||
wholeFile,
|
|
||||||
ktFiles,
|
|
||||||
compileJavaFilesLibraryToJar(javaFilesDir.path, "java-files"),
|
|
||||||
usePsiClassFilesReading = false,
|
|
||||||
excludeNonTypeUseJetbrainsAnnotations = true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+3
-3
@@ -49,17 +49,17 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
|
|||||||
|
|
||||||
testClass<AbstractForeignAnnotationsTest> {
|
testClass<AbstractForeignAnnotationsTest> {
|
||||||
model("diagnostics/foreignAnnotationsTests/tests")
|
model("diagnostics/foreignAnnotationsTests/tests")
|
||||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludeDirs = listOf("typeEnhancementOnCompiledJava"))
|
model("diagnostics/foreignAnnotationsTests/java8Tests")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractForeignAnnotationsNoAnnotationInClasspathTest> {
|
testClass<AbstractForeignAnnotationsNoAnnotationInClasspathTest> {
|
||||||
model("diagnostics/foreignAnnotationsTests/tests")
|
model("diagnostics/foreignAnnotationsTests/tests")
|
||||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludeDirs = listOf("typeEnhancementOnCompiledJava"))
|
model("diagnostics/foreignAnnotationsTests/java8Tests")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest> {
|
testClass<AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest> {
|
||||||
model("diagnostics/foreignAnnotationsTests/tests")
|
model("diagnostics/foreignAnnotationsTests/tests")
|
||||||
model("diagnostics/foreignAnnotationsTests/java8Tests", excludeDirs = listOf("typeEnhancementOnCompiledJava"))
|
model("diagnostics/foreignAnnotationsTests/java8Tests")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractBlackBoxCodegenTest> {
|
testClass<AbstractBlackBoxCodegenTest> {
|
||||||
|
|||||||
-61
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.checkers;
|
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
|
||||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
|
||||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
@TestMetadata("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public class ForeignAnnotationsCompiledJavaDiagnosticTestGenerated extends AbstractForeignAnnotationsCompiledJavaDiagnosticTest {
|
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
|
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ClassTypeParameterBound.kt")
|
|
||||||
public void testClassTypeParameterBound() throws Exception {
|
|
||||||
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
|
|
||||||
public void testClassTypeParameterBoundWithWarnings() throws Exception {
|
|
||||||
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ReturnType.kt")
|
|
||||||
public void testReturnType() throws Exception {
|
|
||||||
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava/ReturnType.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ReturnTypeWithWarnings.kt")
|
|
||||||
public void testReturnTypeWithWarnings() throws Exception {
|
|
||||||
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ValueParameter.kt")
|
|
||||||
public void testValueParameter() throws Exception {
|
|
||||||
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ValueParameterWithWarnings.kt")
|
|
||||||
public void testValueParameterWithWarnings() throws Exception {
|
|
||||||
runTest("compiler/testData/foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,10 +28,6 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
generateTestGroupSuite(args) {
|
generateTestGroupSuite(args) {
|
||||||
testGroup("compiler/tests-java8/tests", "compiler/testData") {
|
testGroup("compiler/tests-java8/tests", "compiler/testData") {
|
||||||
testClass<AbstractForeignAnnotationsCompiledJavaDiagnosticTest> {
|
|
||||||
model("foreignAnnotations/java8Tests/typeEnhancementOnCompiledJava")
|
|
||||||
}
|
|
||||||
|
|
||||||
testClass<AbstractLoadJava8Test> {
|
testClass<AbstractLoadJava8Test> {
|
||||||
model("loadJava8/compiledJava", extension = "java", testMethod = "doTestCompiledJava")
|
model("loadJava8/compiledJava", extension = "java", testMethod = "doTestCompiledJava")
|
||||||
model("loadJava8/sourceJava", extension = "java", testMethod = "doTestSourceJava")
|
model("loadJava8/sourceJava", extension = "java", testMethod = "doTestSourceJava")
|
||||||
|
|||||||
Reference in New Issue
Block a user