[TEST] Migrate AbstractDiagnosticsWithExplicitApi to new test runners
This commit is contained in:
+1
@@ -64,6 +64,7 @@ class LanguageVersionSettingsBuilder {
|
|||||||
analysisFlag(AnalysisFlags.ignoreDataFlowInAssert, trueOrNull(LanguageSettingsDirectives.IGNORE_DATA_FLOW_IN_ASSERT in directives)),
|
analysisFlag(AnalysisFlags.ignoreDataFlowInAssert, trueOrNull(LanguageSettingsDirectives.IGNORE_DATA_FLOW_IN_ASSERT in directives)),
|
||||||
analysisFlag(AnalysisFlags.constraintSystemForOverloadResolution, directives.singleOrZeroValue(LanguageSettingsDirectives.CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION)),
|
analysisFlag(AnalysisFlags.constraintSystemForOverloadResolution, directives.singleOrZeroValue(LanguageSettingsDirectives.CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION)),
|
||||||
analysisFlag(AnalysisFlags.allowResultReturnType, trueOrNull(LanguageSettingsDirectives.ALLOW_RESULT_RETURN_TYPE in directives)),
|
analysisFlag(AnalysisFlags.allowResultReturnType, trueOrNull(LanguageSettingsDirectives.ALLOW_RESULT_RETURN_TYPE in directives)),
|
||||||
|
analysisFlag(AnalysisFlags.explicitApiMode, directives.singleOrZeroValue(LanguageSettingsDirectives.EXPLICIT_API_MODE)),
|
||||||
|
|
||||||
analysisFlag(JvmAnalysisFlags.jvmDefaultMode, directives.singleOrZeroValue(LanguageSettingsDirectives.JVM_DEFAULT_MODE)),
|
analysisFlag(JvmAnalysisFlags.jvmDefaultMode, directives.singleOrZeroValue(LanguageSettingsDirectives.JVM_DEFAULT_MODE)),
|
||||||
analysisFlag(JvmAnalysisFlags.inheritMultifileParts, trueOrNull(LanguageSettingsDirectives.INHERIT_MULTIFILE_PARTS in directives)),
|
analysisFlag(JvmAnalysisFlags.inheritMultifileParts, trueOrNull(LanguageSettingsDirectives.INHERIT_MULTIFILE_PARTS in directives)),
|
||||||
|
|||||||
+7
-1
@@ -7,9 +7,11 @@ package org.jetbrains.kotlin.test.directives
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.config.ApiVersion
|
import org.jetbrains.kotlin.config.ApiVersion
|
||||||
import org.jetbrains.kotlin.config.ConstraintSystemForOverloadResolutionMode
|
import org.jetbrains.kotlin.config.ConstraintSystemForOverloadResolutionMode
|
||||||
|
import org.jetbrains.kotlin.config.ExplicitApiMode
|
||||||
import org.jetbrains.kotlin.config.JvmDefaultMode
|
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||||
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
|
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
|
||||||
|
|
||||||
|
@Suppress("RemoveExplicitTypeArguments")
|
||||||
object LanguageSettingsDirectives : SimpleDirectivesContainer() {
|
object LanguageSettingsDirectives : SimpleDirectivesContainer() {
|
||||||
val LANGUAGE by stringDirective(
|
val LANGUAGE by stringDirective(
|
||||||
description = """
|
description = """
|
||||||
@@ -45,9 +47,13 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
|
|||||||
description = "Allow using Result in return type position"
|
description = "Allow using Result in return type position"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val EXPLICIT_API_MODE by enumDirective<ExplicitApiMode>(
|
||||||
|
"Configures explicit API mode (AnalysisFlags.explicitApiMode)",
|
||||||
|
additionalParser = ExplicitApiMode.Companion::fromString
|
||||||
|
)
|
||||||
|
|
||||||
// --------------------- Jvm Analysis Flags ---------------------
|
// --------------------- Jvm Analysis Flags ---------------------
|
||||||
|
|
||||||
@Suppress("RemoveExplicitTypeArguments")
|
|
||||||
val JVM_DEFAULT_MODE by enumDirective<JvmDefaultMode>(
|
val JVM_DEFAULT_MODE by enumDirective<JvmDefaultMode>(
|
||||||
description = "Configures corresponding analysis flag (JvmAnalysisFlags.jvmDefaultMode)",
|
description = "Configures corresponding analysis flag (JvmAnalysisFlags.jvmDefaultMode)",
|
||||||
additionalParser = JvmDefaultMode.Companion::fromStringOrNull
|
additionalParser = JvmDefaultMode.Companion::fromStringOrNull
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
annotation class A
|
||||||
|
|
||||||
|
@Target(
|
||||||
|
AnnotationTarget.CLASS,
|
||||||
|
AnnotationTarget.PROPERTY,
|
||||||
|
AnnotationTarget.CONSTRUCTOR,
|
||||||
|
AnnotationTarget.FUNCTION
|
||||||
|
)
|
||||||
|
public annotation class B
|
||||||
|
|
||||||
|
annotation class C(val a: String)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Foo1 KDoc
|
||||||
|
*/
|
||||||
|
@B
|
||||||
|
class Foo1() {}
|
||||||
|
|
||||||
|
public class Foo2() {
|
||||||
|
/**
|
||||||
|
* KDoc for methodWithAnnotations
|
||||||
|
*/
|
||||||
|
@B
|
||||||
|
fun methodWithAnnotations() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property KDoc
|
||||||
|
*/
|
||||||
|
@B
|
||||||
|
var simple: Int = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class ClassWithOpen {
|
||||||
|
/**
|
||||||
|
* constructor KDoc
|
||||||
|
*/
|
||||||
|
@B
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* KDoc for openAnnotatedMethod
|
||||||
|
*/
|
||||||
|
@B
|
||||||
|
open fun openAnnotatedMethod() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* KDoc for Foo1
|
||||||
|
*/
|
||||||
|
class Foo1() {}
|
||||||
|
|
||||||
|
public class Foo2() {
|
||||||
|
/**
|
||||||
|
* KDoc for method
|
||||||
|
*/
|
||||||
|
fun method() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* KDoc for method2
|
||||||
|
*/
|
||||||
|
public fun method2() {}
|
||||||
|
private fun method3() {}
|
||||||
|
|
||||||
|
fun implicit() = 10
|
||||||
|
public fun implicit2() = 10
|
||||||
|
public fun implicit3(): Int = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class ClassWithOpen() {
|
||||||
|
/**
|
||||||
|
* KDoc for method
|
||||||
|
*/
|
||||||
|
fun method() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* KDoc for openMethod
|
||||||
|
*/
|
||||||
|
open fun openMethod() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public data class FooData(val i: Int, val s: String)
|
||||||
|
|
||||||
|
data class FooData2(val i: Int, val s: String)
|
||||||
|
|
||||||
|
public class WithNested {
|
||||||
|
class Nested {}
|
||||||
|
inner class Inner {}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Foo { A, B }
|
||||||
|
public enum class Bar { A, B }
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
public class Bar {
|
||||||
|
companion object {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Bar2 {
|
||||||
|
companion object MyCompanion {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Bar3 {
|
||||||
|
/**
|
||||||
|
* Nested object KDoc
|
||||||
|
*/
|
||||||
|
object NestedObject {}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class FooData2(val i: Int, val s: String) {
|
||||||
|
object NestedObject {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
public class Foo1 () {}
|
||||||
|
public class Foo2 constructor() {}
|
||||||
|
public class Foo3 public constructor() {}
|
||||||
|
public class Foo4 private constructor() {}
|
||||||
|
|
||||||
|
public class Foo5 {
|
||||||
|
/**
|
||||||
|
* constructor KDoc
|
||||||
|
*/
|
||||||
|
constructor() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Foo6 {
|
||||||
|
public constructor() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// !DIAGNOSTICS: -EXPERIMENTAL_FEATURE_WARNING
|
||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
inline class Value1(val inner: Int)
|
||||||
|
public inline class Value2(val inner: Int)
|
||||||
|
inline class Value3(public val inner: Int)
|
||||||
|
public inline class Value4(public val inner: Int)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
interface I1 {
|
||||||
|
fun i()
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface I2 {
|
||||||
|
fun i()
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface I3 {
|
||||||
|
public fun i()
|
||||||
|
public val v: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface I4 {
|
||||||
|
public fun i(): Int
|
||||||
|
public val v: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Impl: I3 {
|
||||||
|
override fun i() {}
|
||||||
|
override val v: Int
|
||||||
|
get() = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Impl2: I4 {
|
||||||
|
override fun i() = 10
|
||||||
|
override val v = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PrivateImpl: I4 {
|
||||||
|
override fun i() = 10
|
||||||
|
override val v = 10
|
||||||
|
}
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// SKIP_TXT
|
// SKIP_TXT
|
||||||
|
|
||||||
private class Foo {
|
private class Foo {
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
public class Foo(val bar: Int, private var bar2: String, internal var bar3: Long, public var bar4: Int) {
|
||||||
|
/**
|
||||||
|
* Property KDoc
|
||||||
|
*/
|
||||||
|
var simple: Int = 10
|
||||||
|
public var simple2: Int = 10
|
||||||
|
|
||||||
|
val withGetter: Int
|
||||||
|
get() = 10
|
||||||
|
|
||||||
|
public val withGetter2: Int
|
||||||
|
get() = 10
|
||||||
|
|
||||||
|
var getterAndSetter: Int = 10
|
||||||
|
get() = field
|
||||||
|
set(v) { field = v }
|
||||||
|
|
||||||
|
public var getterAndSetter2: Int = 10
|
||||||
|
get() = field
|
||||||
|
set(v) { field = v }
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
public class A {
|
||||||
|
@PublishedApi
|
||||||
|
internal fun foo() = 1
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* foo KDoc
|
||||||
|
*/
|
||||||
|
fun foo() {}
|
||||||
|
|
||||||
|
public fun foo2() {}
|
||||||
|
|
||||||
|
fun bar() = 10
|
||||||
|
public fun bar2() = 10
|
||||||
|
public fun bar3(): Int = 10
|
||||||
Generated
+70
@@ -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
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
|
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+70
@@ -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
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
|
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+9
@@ -5,10 +5,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.test.runners
|
package org.jetbrains.kotlin.test.runners
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.config.ExplicitApiMode
|
||||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
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.USE_PSI_CLASS_FILES_READING
|
||||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB
|
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.ClassicFrontendFacade
|
||||||
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
|
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
|
||||||
import org.jetbrains.kotlin.test.frontend.classic.handlers.DeclarationsDumpHandler
|
import org.jetbrains.kotlin.test.frontend.classic.handlers.DeclarationsDumpHandler
|
||||||
@@ -61,5 +64,11 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() {
|
|||||||
+WITH_STDLIB
|
+WITH_STDLIB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forTestsMatching("compiler/testData/diagnostics/tests/testsWithExplicitApi/*") {
|
||||||
|
defaultDirectives {
|
||||||
|
EXPLICIT_API_MODE with ExplicitApiMode.STRICT
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2019 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.config.*
|
|
||||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
|
||||||
|
|
||||||
abstract class AbstractDiagnosticsWithExplicitApi : AbstractDiagnosticsTest() {
|
|
||||||
override fun defaultLanguageVersionSettings(): LanguageVersionSettings =
|
|
||||||
CompilerTestLanguageVersionSettings(
|
|
||||||
DEFAULT_DIAGNOSTIC_TESTS_FEATURES,
|
|
||||||
LanguageVersionSettingsImpl.DEFAULT.apiVersion,
|
|
||||||
LanguageVersionSettingsImpl.DEFAULT.languageVersion,
|
|
||||||
mapOf(AnalysisFlags.explicitApiMode to ExplicitApiMode.STRICT)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
-80
@@ -1,80 +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 com.intellij.testFramework.TestDataPath;
|
|
||||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
|
||||||
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/diagnostics/testsWithExplicitApi")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public class DiagnosticsWithExplicitApiGenerated extends AbstractDiagnosticsWithExplicitApi {
|
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInTestsWithExplicitApi() throws Exception {
|
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithExplicitApi"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("annotations.kt")
|
|
||||||
public void testAnnotations() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/annotations.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("classes.kt")
|
|
||||||
public void testClasses() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/classes.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("companionObject.kt")
|
|
||||||
public void testCompanionObject() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/companionObject.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("constructors.kt")
|
|
||||||
public void testConstructors() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/constructors.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("inlineClasses.kt")
|
|
||||||
public void testInlineClasses() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/inlineClasses.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("interfaces.kt")
|
|
||||||
public void testInterfaces() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/interfaces.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("mustBeEffectivelyPublic.kt")
|
|
||||||
public void testMustBeEffectivelyPublic() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/mustBeEffectivelyPublic.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("properties.kt")
|
|
||||||
public void testProperties() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/properties.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("publishedApi.kt")
|
|
||||||
public void testPublishedApi() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/publishedApi.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("toplevel.kt")
|
|
||||||
public void testToplevel() throws Exception {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithExplicitApi/toplevel.kt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -92,10 +92,6 @@ fun main(args: Array<String>) {
|
|||||||
model("diagnostics/testsWithUnsignedTypes")
|
model("diagnostics/testsWithUnsignedTypes")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractDiagnosticsWithExplicitApi> {
|
|
||||||
model("diagnostics/testsWithExplicitApi")
|
|
||||||
}
|
|
||||||
|
|
||||||
testClass<AbstractDiagnosticsTestWithOldJvmBackend> {
|
testClass<AbstractDiagnosticsTestWithOldJvmBackend> {
|
||||||
model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_OLD)
|
model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_OLD)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user