[TEST] Migrate AbstractDiagnosticsWithExplicitApi to new test runners

This commit is contained in:
Dmitriy Novozhilov
2020-12-09 12:28:49 +03:00
parent c0e4452cf8
commit 23e704f361
27 changed files with 373 additions and 104 deletions
@@ -28200,6 +28200,76 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/testsWithExplicitApi")
@TestDataPath("$PROJECT_ROOT")
public class TestsWithExplicitApi extends AbstractDiagnosticTest {
@Test
public void testAllFilesPresentInTestsWithExplicitApi() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithExplicitApi"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("annotations.kt")
public void testAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/annotations.kt");
}
@Test
@TestMetadata("classes.kt")
public void testClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/classes.kt");
}
@Test
@TestMetadata("companionObject.kt")
public void testCompanionObject() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/companionObject.kt");
}
@Test
@TestMetadata("constructors.kt")
public void testConstructors() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/constructors.kt");
}
@Test
@TestMetadata("inlineClasses.kt")
public void testInlineClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/inlineClasses.kt");
}
@Test
@TestMetadata("interfaces.kt")
public void testInterfaces() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/interfaces.kt");
}
@Test
@TestMetadata("mustBeEffectivelyPublic.kt")
public void testMustBeEffectivelyPublic() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/mustBeEffectivelyPublic.kt");
}
@Test
@TestMetadata("properties.kt")
public void testProperties() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/properties.kt");
}
@Test
@TestMetadata("publishedApi.kt")
public void testPublishedApi() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/publishedApi.kt");
}
@Test
@TestMetadata("toplevel.kt")
public void testToplevel() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/toplevel.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
@TestDataPath("$PROJECT_ROOT")
@@ -28104,6 +28104,76 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/testsWithExplicitApi")
@TestDataPath("$PROJECT_ROOT")
public class TestsWithExplicitApi extends AbstractFirDiagnosticTest {
@Test
public void testAllFilesPresentInTestsWithExplicitApi() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithExplicitApi"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("annotations.kt")
public void testAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/annotations.kt");
}
@Test
@TestMetadata("classes.kt")
public void testClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/classes.kt");
}
@Test
@TestMetadata("companionObject.kt")
public void testCompanionObject() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/companionObject.kt");
}
@Test
@TestMetadata("constructors.kt")
public void testConstructors() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/constructors.kt");
}
@Test
@TestMetadata("inlineClasses.kt")
public void testInlineClasses() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/inlineClasses.kt");
}
@Test
@TestMetadata("interfaces.kt")
public void testInterfaces() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/interfaces.kt");
}
@Test
@TestMetadata("mustBeEffectivelyPublic.kt")
public void testMustBeEffectivelyPublic() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/mustBeEffectivelyPublic.kt");
}
@Test
@TestMetadata("properties.kt")
public void testProperties() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/properties.kt");
}
@Test
@TestMetadata("publishedApi.kt")
public void testPublishedApi() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/publishedApi.kt");
}
@Test
@TestMetadata("toplevel.kt")
public void testToplevel() throws Exception {
runTest("compiler/testData/diagnostics/tests/testsWithExplicitApi/toplevel.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
@TestDataPath("$PROJECT_ROOT")
@@ -5,10 +5,13 @@
package org.jetbrains.kotlin.test.runners
import org.jetbrains.kotlin.config.ExplicitApiMode
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.EXPLICIT_API_MODE
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
import org.jetbrains.kotlin.test.frontend.classic.handlers.DeclarationsDumpHandler
@@ -61,5 +64,11 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() {
+WITH_STDLIB
}
}
forTestsMatching("compiler/testData/diagnostics/tests/testsWithExplicitApi/*") {
defaultDirectives {
EXPLICIT_API_MODE with ExplicitApiMode.STRICT
}
}
}
}