[Test] Migrate AbstractDiagnosticsWithJdk15Test to new infrastructure
This commit is contained in:
committed by
TeamCityServer
parent
02fb11a2cd
commit
a9f913a97f
+90
@@ -28236,6 +28236,96 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava15 extends AbstractFirDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava15() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class JvmRecord extends AbstractFirDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInJvmRecord() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("diagnostics.kt")
|
||||
public void testDiagnostics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/diagnostics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/disabledFeature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("irrelevantFields.kt")
|
||||
public void testIrrelevantFields() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/irrelevantFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jvmRecordDescriptorStructure.kt")
|
||||
public void testJvmRecordDescriptorStructure() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleRecords.kt")
|
||||
public void testSimpleRecords() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/simpleRecords.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypesCheck.kt")
|
||||
public void testSupertypesCheck() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/supertypesCheck.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class SealedClasses extends AbstractFirDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaSealedClassExhaustiveness.kt")
|
||||
public void testJavaSealedClassExhaustiveness() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaSealedInterfaceExhaustiveness.kt")
|
||||
public void testJavaSealedInterfaceExhaustiveness() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kotlinInheritsJavaClass.kt")
|
||||
public void testKotlinInheritsJavaClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kotlinInheritsJavaInterface.kt")
|
||||
public void testKotlinInheritsJavaInterface() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+1
@@ -67,6 +67,7 @@ class LanguageVersionSettingsBuilder {
|
||||
analysisFlag(JvmAnalysisFlags.jvmDefaultMode, directives.singleOrZeroValue(LanguageSettingsDirectives.JVM_DEFAULT_MODE)),
|
||||
analysisFlag(JvmAnalysisFlags.inheritMultifileParts, trueOrNull(LanguageSettingsDirectives.INHERIT_MULTIFILE_PARTS in directives)),
|
||||
analysisFlag(JvmAnalysisFlags.sanitizeParentheses, trueOrNull(LanguageSettingsDirectives.SANITIZE_PARENTHESES in directives)),
|
||||
analysisFlag(JvmAnalysisFlags.enableJvmPreview, trueOrNull(LanguageSettingsDirectives.ENABLE_JVM_PREVIEW in directives)),
|
||||
|
||||
analysisFlag(AnalysisFlags.explicitApiVersion, trueOrNull(apiVersion != null)),
|
||||
)
|
||||
|
||||
+2
@@ -67,6 +67,8 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
|
||||
description = "Enables corresponding analysis flag (JvmAnalysisFlags.sanitizeParentheses)"
|
||||
)
|
||||
|
||||
val ENABLE_JVM_PREVIEW by directive("Enable JVM preview features")
|
||||
|
||||
// --------------------- Utils ---------------------
|
||||
|
||||
fun parseApiVersion(versionString: String): ApiVersion = when (versionString) {
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
// !API_VERSION: 1.5
|
||||
// !LANGUAGE: +JvmRecordSupport
|
||||
// SKIP_TXT
|
||||
// JVM_TARGET: 15
|
||||
// ENABLE_JVM_PREVIEW
|
||||
|
||||
@JvmRecord
|
||||
class A0
|
||||
|
||||
@JvmRecord
|
||||
class A1 {
|
||||
constructor()
|
||||
}
|
||||
|
||||
@JvmRecord
|
||||
class A2()
|
||||
|
||||
@JvmRecord
|
||||
class A3(name: String)
|
||||
|
||||
@JvmRecord
|
||||
class A4(var name: String)
|
||||
|
||||
@JvmRecord
|
||||
class A5(vararg val name: String, y: Int)
|
||||
|
||||
@JvmRecord
|
||||
open class A6(val x: String)
|
||||
|
||||
@JvmRecord
|
||||
abstract class A7(val x: String)
|
||||
|
||||
@JvmRecord
|
||||
sealed class A8(val x: String)
|
||||
|
||||
@JvmRecord
|
||||
enum class A9(val x: String) {
|
||||
X("");
|
||||
}
|
||||
|
||||
@JvmRecord
|
||||
class A10(
|
||||
val x: String,
|
||||
val y: Int,
|
||||
vararg val z: Double,
|
||||
)
|
||||
|
||||
fun main() {
|
||||
@JvmRecord
|
||||
class Local
|
||||
}
|
||||
|
||||
class Outer {
|
||||
@JvmRecord
|
||||
inner class Inner(val name: String)
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// !API_VERSION: 1.5
|
||||
// !LANGUAGE: -JvmRecordSupport
|
||||
// SKIP_TXT
|
||||
// FILE: JRecord.java
|
||||
public record JRecord(int x, CharSequence y) {}
|
||||
// FILE: main.kt
|
||||
|
||||
@JvmRecord
|
||||
class MyRec(
|
||||
val x: String,
|
||||
val y: Int,
|
||||
vararg val z: Double,
|
||||
)
|
||||
|
||||
fun foo(jr: JRecord) {
|
||||
<!INAPPLICABLE_CANDIDATE!>JRecord<!>(1, "")
|
||||
|
||||
jr.<!UNRESOLVED_REFERENCE!>x<!>()
|
||||
jr.<!UNRESOLVED_REFERENCE!>y<!>()
|
||||
|
||||
jr.<!UNRESOLVED_REFERENCE!>x<!>
|
||||
jr.<!UNRESOLVED_REFERENCE!>y<!>
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// !API_VERSION: 1.5
|
||||
// !LANGUAGE: +JvmRecordSupport
|
||||
// SKIP_TXT
|
||||
// JVM_TARGET: 15
|
||||
// ENABLE_JVM_PREVIEW
|
||||
|
||||
interface I
|
||||
|
||||
val i: I = object : I {}
|
||||
|
||||
@JvmRecord
|
||||
data class MyRec1(val name: String) : I by i
|
||||
|
||||
@JvmRecord
|
||||
data class MyRec2(val name: String) {
|
||||
val x: Int = 0
|
||||
}
|
||||
|
||||
@JvmRecord
|
||||
data class MyRec3(val name: String) {
|
||||
val y: String
|
||||
get() = field + "1"
|
||||
|
||||
init {
|
||||
y = ""
|
||||
}
|
||||
}
|
||||
|
||||
@JvmRecord
|
||||
data class MyRec4(val name: String) {
|
||||
val z: Int by lazy { 1 }
|
||||
}
|
||||
|
||||
@JvmRecord
|
||||
data class MyRec5(val name: String) {
|
||||
val w: String get() = name + "1"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// !API_VERSION: 1.5
|
||||
// !LANGUAGE: +JvmRecordSupport
|
||||
// JVM_TARGET: 15
|
||||
// ENABLE_JVM_PREVIEW
|
||||
|
||||
@JvmRecord
|
||||
class BasicRecord(val x: String)
|
||||
|
||||
@JvmRecord
|
||||
data class BasicDataRecord(val x: String)
|
||||
|
||||
@JvmRecord
|
||||
class BasicRecordWithSuperClass(val x: String) : Record()
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !API_VERSION: 1.5
|
||||
// !LANGUAGE: +JvmRecordSupport
|
||||
// FILE: MyRecord.java
|
||||
public record MyRecord(int x, CharSequence y) {
|
||||
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo(mr: MyRecord) {
|
||||
<!INAPPLICABLE_CANDIDATE!>MyRecord<!>(1, "")
|
||||
|
||||
mr.<!UNRESOLVED_REFERENCE!>x<!>()
|
||||
mr.<!UNRESOLVED_REFERENCE!>y<!>()
|
||||
|
||||
mr.<!UNRESOLVED_REFERENCE!>x<!>
|
||||
mr.<!UNRESOLVED_REFERENCE!>y<!>
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// !API_VERSION: 1.5
|
||||
// !LANGUAGE: +JvmRecordSupport
|
||||
// JVM_TARGET: 15
|
||||
// ENABLE_JVM_PREVIEW
|
||||
|
||||
abstract class Abstract
|
||||
interface I
|
||||
|
||||
@JvmRecord
|
||||
data class A1(val x: String) : Abstract(), I
|
||||
|
||||
@JvmRecord
|
||||
data class A2(val x: String) : Any(), I
|
||||
|
||||
@JvmRecord
|
||||
data class A3(val x: String) : Record(), I
|
||||
|
||||
@JvmRecord
|
||||
data class A4(val x: String) : java.lang.Record(), I
|
||||
|
||||
@JvmRecord
|
||||
data class A5(val x: String) : I
|
||||
|
||||
data class A6(val x: String) : Record(), I
|
||||
|
||||
data class A7(val x: String) : java.lang.Record(), I
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// ISSUE: KT-41215, KT-43551
|
||||
|
||||
// FILE: Base.java
|
||||
public sealed class Base permits A, B {}
|
||||
|
||||
// FILE: A.java
|
||||
public final class A extends Base {}
|
||||
|
||||
// FILE: B.java
|
||||
public sealed class B extends Base permits B.C, B.D {
|
||||
public static final class C implements B {}
|
||||
|
||||
public static non-sealed class D extends B {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test_ok_1(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B -> 2
|
||||
}
|
||||
}
|
||||
|
||||
fun test_ok_2(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B.C -> 2
|
||||
is B.D -> 3
|
||||
}
|
||||
}
|
||||
|
||||
fun test_error_1(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
}
|
||||
}
|
||||
|
||||
fun test_error_2(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B.C -> 2
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// ISSUE: KT-41215, KT-43551
|
||||
|
||||
// FILE: Base.java
|
||||
public sealed interface Base permits A, B, E {}
|
||||
|
||||
// FILE: A.java
|
||||
public non-sealed interface A extends Base {}
|
||||
|
||||
// FILE: B.java
|
||||
public sealed interface B extends Base permits B.C, B.D {
|
||||
public static final class C implements B {}
|
||||
|
||||
public static non-sealed interface D extends B {}
|
||||
}
|
||||
|
||||
// FILE: E.java
|
||||
public enum E implements Base {
|
||||
First, Second
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test_ok_1(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B -> 2
|
||||
is E -> 3
|
||||
}
|
||||
}
|
||||
|
||||
fun test_ok_2(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B.C -> 2
|
||||
is B.D -> 3
|
||||
E.First -> 4
|
||||
E.Second -> 5
|
||||
}
|
||||
}
|
||||
|
||||
fun test_error_1(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B -> 2
|
||||
}
|
||||
}
|
||||
|
||||
fun test_error_2(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B.C -> 2
|
||||
is B.D -> 3
|
||||
E.Second -> 5
|
||||
}
|
||||
}
|
||||
|
||||
fun test_error_3(base: Base) {
|
||||
val x = when (base) {
|
||||
is A -> 1
|
||||
is B.C -> 2
|
||||
E.First -> 4
|
||||
E.Second -> 5
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// ISSUE: KT-41215
|
||||
|
||||
// FILE: Base.java
|
||||
public sealed class Base permits A, B {}
|
||||
|
||||
// FILE: A.java
|
||||
public final class A extends Base {}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
class B : Base()
|
||||
compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.fir.kt
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// ISSUE: KT-41215
|
||||
|
||||
// FILE: Base.java
|
||||
public sealed interface Base permits A, B {}
|
||||
|
||||
// FILE: A.java
|
||||
public final class A extends Base {}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
class B : Base
|
||||
Generated
+90
@@ -28332,6 +28332,96 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava15 extends AbstractDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava15() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class JvmRecord extends AbstractDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInJvmRecord() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("diagnostics.kt")
|
||||
public void testDiagnostics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/diagnostics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/disabledFeature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("irrelevantFields.kt")
|
||||
public void testIrrelevantFields() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/irrelevantFields.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("jvmRecordDescriptorStructure.kt")
|
||||
public void testJvmRecordDescriptorStructure() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleRecords.kt")
|
||||
public void testSimpleRecords() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/simpleRecords.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypesCheck.kt")
|
||||
public void testSupertypesCheck() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/supertypesCheck.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class SealedClasses extends AbstractDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaSealedClassExhaustiveness.kt")
|
||||
public void testJavaSealedClassExhaustiveness() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaSealedInterfaceExhaustiveness.kt")
|
||||
public void testJavaSealedInterfaceExhaustiveness() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kotlinInheritsJavaClass.kt")
|
||||
public void testKotlinInheritsJavaClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kotlinInheritsJavaInterface.kt")
|
||||
public void testKotlinInheritsJavaInterface() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/thisAndSuper")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+11
-1
@@ -7,10 +7,12 @@ package org.jetbrains.kotlin.test.runners
|
||||
|
||||
import org.jetbrains.kotlin.config.ExplicitApiMode
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_JVM_DIAGNOSTICS_ON_FRONTEND
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_REFLECT
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.EXPLICIT_API_MODE
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.USE_EXPERIMENTAL
|
||||
@@ -80,5 +82,13 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() {
|
||||
+WITH_STDLIB
|
||||
}
|
||||
}
|
||||
|
||||
forTestsMatching("compiler/testData/diagnostics/tests/testsWithJava15/*") {
|
||||
defaultDirectives {
|
||||
JDK_KIND with TestJdkKind.FULL_JDK_15
|
||||
+WITH_STDLIB
|
||||
+WITH_REFLECT
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-2
@@ -6,15 +6,14 @@
|
||||
package org.jetbrains.kotlin.test.runners
|
||||
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives
|
||||
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.COMPARE_WITH_LIGHT_TREE
|
||||
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.FIR_DUMP
|
||||
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.USE_LIGHT_TREE
|
||||
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.WITH_EXTENDED_CHECKERS
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
|
||||
import org.jetbrains.kotlin.test.frontend.fir.FirFailingTestSuppressor
|
||||
import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade
|
||||
import org.jetbrains.kotlin.test.frontend.fir.handlers.*
|
||||
@@ -82,6 +81,14 @@ abstract class AbstractFirDiagnosticTest : AbstractKotlinCompilerTest() {
|
||||
+WITH_EXTENDED_CHECKERS
|
||||
}
|
||||
}
|
||||
|
||||
forTestsMatching("compiler/testData/diagnostics/tests/testsWithJava15/*") {
|
||||
defaultDirectives {
|
||||
JvmEnvironmentConfigurationDirectives.JDK_KIND with TestJdkKind.FULL_JDK_15
|
||||
+WITH_STDLIB
|
||||
+JvmEnvironmentConfigurationDirectives.WITH_REFLECT
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
|
||||
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
|
||||
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
|
||||
import org.jetbrains.kotlin.test.model.BackendKinds
|
||||
@@ -62,6 +63,9 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
|
||||
TestJdkKind.FULL_JDK_9 -> {
|
||||
configuration.put(JVMConfigurationKeys.JDK_HOME, KtTestUtil.getJdk9Home())
|
||||
}
|
||||
TestJdkKind.FULL_JDK_15 -> {
|
||||
configuration.put(JVMConfigurationKeys.JDK_HOME, KtTestUtil.getJdk15Home())
|
||||
}
|
||||
TestJdkKind.FULL_JDK -> {
|
||||
if (SystemInfo.IS_AT_LEAST_JAVA9) {
|
||||
configuration.put(JVMConfigurationKeys.JDK_HOME, File(System.getProperty("java.home")))
|
||||
@@ -96,6 +100,10 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
|
||||
configuration.addJvmClasspathRoot(ForTestCompileRuntime.androidAnnotationsForTests())
|
||||
}
|
||||
|
||||
if (LanguageSettingsDirectives.ENABLE_JVM_PREVIEW in module.directives) {
|
||||
configuration.put(JVMConfigurationKeys.ENABLE_JVM_PREVIEW, true)
|
||||
}
|
||||
|
||||
val isIr = module.backendKind == BackendKinds.IrBackend
|
||||
configuration.put(JVMConfigurationKeys.IR, isIr)
|
||||
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.kotlin.checkers
|
||||
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
|
||||
abstract class AbstractDiagnosticsWithJdk15Test : AbstractDiagnosticsTest() {
|
||||
|
||||
override fun getTestJdkKind(files: List<TestFile>): TestJdkKind {
|
||||
return TestJdkKind.FULL_JDK_15
|
||||
}
|
||||
|
||||
override fun extractConfigurationKind(files: List<TestFile>): ConfigurationKind {
|
||||
return ConfigurationKind.ALL
|
||||
}
|
||||
}
|
||||
-4
@@ -69,10 +69,6 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
|
||||
model("diagnostics/testsWithJsStdLibAndBackendCompilation")
|
||||
}
|
||||
|
||||
testClass<AbstractDiagnosticsWithJdk15Test> {
|
||||
model("diagnostics/testsWithJava15")
|
||||
}
|
||||
|
||||
testClass<AbstractMultiPlatformIntegrationTest> {
|
||||
model("multiplatform", extension = null, recursive = true, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
-107
@@ -1,107 +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.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/diagnostics/testsWithJava15")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class DiagnosticsWithJdk15TestGenerated extends AbstractDiagnosticsWithJdk15Test {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTestsWithJava15() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithJava15/jvmRecord")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JvmRecord extends AbstractDiagnosticsWithJdk15Test {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInJvmRecord() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15/jvmRecord"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("diagnostics.kt")
|
||||
public void testDiagnostics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/diagnostics.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("disabledFeature.kt")
|
||||
public void testDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/disabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("irrelevantFields.kt")
|
||||
public void testIrrelevantFields() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/irrelevantFields.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmRecordDescriptorStructure.kt")
|
||||
public void testJvmRecordDescriptorStructure() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/jvmRecordDescriptorStructure.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleRecords.kt")
|
||||
public void testSimpleRecords() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/simpleRecords.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("supertypesCheck.kt")
|
||||
public void testSupertypesCheck() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/jvmRecord/supertypesCheck.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithJava15/sealedClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SealedClasses extends AbstractDiagnosticsWithJdk15Test {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSealedClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava15/sealedClasses"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaSealedClassExhaustiveness.kt")
|
||||
public void testJavaSealedClassExhaustiveness() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedClassExhaustiveness.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaSealedInterfaceExhaustiveness.kt")
|
||||
public void testJavaSealedInterfaceExhaustiveness() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/javaSealedInterfaceExhaustiveness.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinInheritsJavaClass.kt")
|
||||
public void testKotlinInheritsJavaClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinInheritsJavaInterface.kt")
|
||||
public void testKotlinInheritsJavaInterface() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJava15/sealedClasses/kotlinInheritsJavaInterface.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user