[Serialization] Migrate all tests to new test infrastructure
This commit is contained in:
committed by
teamcity
parent
4dd7437df1
commit
a2ffba275c
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.fir.plugin.runners.AbstractFirPluginDiagnosticTest
|
|||||||
import org.jetbrains.kotlin.generators.TestGroup
|
import org.jetbrains.kotlin.generators.TestGroup
|
||||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
||||||
import org.jetbrains.kotlin.generators.model.AnnotationModel
|
|
||||||
import org.jetbrains.kotlin.generators.model.annotation
|
import org.jetbrains.kotlin.generators.model.annotation
|
||||||
import org.jetbrains.kotlin.incremental.*
|
import org.jetbrains.kotlin.incremental.*
|
||||||
import org.jetbrains.kotlin.jvm.abi.*
|
import org.jetbrains.kotlin.jvm.abi.*
|
||||||
@@ -38,9 +37,6 @@ import org.jetbrains.kotlin.samWithReceiver.*
|
|||||||
import org.jetbrains.kotlin.test.TargetBackend
|
import org.jetbrains.kotlin.test.TargetBackend
|
||||||
import org.jetbrains.kotlinx.atomicfu.AbstractAtomicfuJsIrTest
|
import org.jetbrains.kotlinx.atomicfu.AbstractAtomicfuJsIrTest
|
||||||
import org.jetbrains.kotlinx.atomicfu.AbstractAtomicfuJvmIrTest
|
import org.jetbrains.kotlinx.atomicfu.AbstractAtomicfuJvmIrTest
|
||||||
import org.jetbrains.kotlinx.serialization.AbstractSerializationIrBytecodeListingTest
|
|
||||||
import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginBytecodeListingTest
|
|
||||||
import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnosticTest
|
|
||||||
import org.junit.jupiter.api.Tag
|
import org.junit.jupiter.api.Tag
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
@@ -16,14 +16,12 @@ dependencies {
|
|||||||
testApi(project(":compiler:cli"))
|
testApi(project(":compiler:cli"))
|
||||||
testApi(project(":kotlinx-serialization-compiler-plugin.cli"))
|
testApi(project(":kotlinx-serialization-compiler-plugin.cli"))
|
||||||
|
|
||||||
testApi(projectTests(":compiler:tests-common"))
|
|
||||||
testApi(projectTests(":compiler:test-infrastructure"))
|
testApi(projectTests(":compiler:test-infrastructure"))
|
||||||
testApi(projectTests(":compiler:test-infrastructure-utils"))
|
testApi(projectTests(":compiler:test-infrastructure-utils"))
|
||||||
testApi(projectTests(":compiler:tests-compiler-utils"))
|
testApi(projectTests(":compiler:tests-compiler-utils"))
|
||||||
testApi(projectTests(":compiler:tests-common-new"))
|
testApi(projectTests(":compiler:tests-common-new"))
|
||||||
testImplementation(projectTests(":generators:test-generator"))
|
testImplementation(projectTests(":generators:test-generator"))
|
||||||
testApi(commonDependency("junit:junit"))
|
testApiJUnit5()
|
||||||
testApiJUnit5(vintageEngine = true)
|
|
||||||
|
|
||||||
testImplementation(project(":kotlinx-serialization-compiler-plugin.common"))
|
testImplementation(project(":kotlinx-serialization-compiler-plugin.common"))
|
||||||
testImplementation(project(":kotlinx-serialization-compiler-plugin.k1"))
|
testImplementation(project(":kotlinx-serialization-compiler-plugin.k1"))
|
||||||
@@ -37,6 +35,7 @@ dependencies {
|
|||||||
testRuntimeOnly(intellijCore())
|
testRuntimeOnly(intellijCore())
|
||||||
testRuntimeOnly(project(":kotlin-reflect"))
|
testRuntimeOnly(project(":kotlin-reflect"))
|
||||||
testRuntimeOnly(project(":core:descriptors.runtime"))
|
testRuntimeOnly(project(":core:descriptors.runtime"))
|
||||||
|
testRuntimeOnly(project(":compiler:fir:fir-serialization"))
|
||||||
}
|
}
|
||||||
|
|
||||||
optInToExperimentalCompilerApi()
|
optInToExperimentalCompilerApi()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
@@ -75,4 +74,4 @@ fun testOnFile(): String {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return testOnFile()
|
return testOnFile()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
@@ -65,4 +64,4 @@ fun box(): String {
|
|||||||
assertEquals("ObjectSerializerDummy", descs[3].serialName)
|
assertEquals("ObjectSerializerDummy", descs[3].serialName)
|
||||||
assertEquals("ClassSerializerOnClass", descs[4].serialName)
|
assertEquals("ClassSerializerOnClass", descs[4].serialName)
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
@@ -45,4 +44,4 @@ fun testSerialization(previous: String): String {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return testSerialization(testSerializers())
|
return testSerialization(testSerializers())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
@@ -19,4 +18,4 @@ fun box(): String {
|
|||||||
val decoded = Json.decodeFromString(Holder.serializer(), str)
|
val decoded = Json.decodeFromString(Holder.serializer(), str)
|
||||||
if (decoded.f1.t != holder.f1.t) return "f1.t: ${decoded.f1.t}"
|
if (decoded.f1.t != holder.f1.t) return "f1.t: ${decoded.f1.t}"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
@@ -19,4 +18,4 @@ fun box(): String {
|
|||||||
val s = Json.encodeToString(Holder.serializer(), Holder(Foo(42)))
|
val s = Json.encodeToString(Holder.serializer(), Holder(Foo(42)))
|
||||||
if (s != """{"f":42}""") return s
|
if (s != """{"f":42}""") return s
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
@@ -34,4 +33,4 @@ fun box(): String {
|
|||||||
desc.checkKind(1, "OPEN")
|
desc.checkKind(1, "OPEN")
|
||||||
desc.checkKind(2, "SEALED")
|
desc.checkKind(2, "SEALED")
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
// CURIOUS_ABOUT serialize, deserialize, write$Self, childSerializers, <init>, <clinit>, getDescriptor
|
// CURIOUS_ABOUT: serialize, deserialize, write$Self, childSerializers, <init>, <clinit>, getDescriptor
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -10,4 +10,4 @@ class User(val firstName: String, val lastName: String)
|
|||||||
class OptionalUser(val user: User = User("", ""))
|
class OptionalUser(val user: User = User("", ""))
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class ListOfUsers(val list: List<User>)
|
class ListOfUsers(val list: List<User>)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// CURIOUS_ABOUT <init>, <clinit>
|
// CURIOUS_ABOUT: <init>, <clinit>
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -10,4 +10,4 @@ fun interface A {
|
|||||||
fun generateImpl() = A { "Hello, world!" }
|
fun generateImpl() = A { "Hello, world!" }
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class Test : A by generateImpl()
|
class Test : A by generateImpl()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// CURIOUS_ABOUT deserialize, write$Self, childSerializers, <init>, <clinit>, invoke, serializer
|
// CURIOUS_ABOUT: deserialize, write$Self, childSerializers, <init>, <clinit>, invoke, serializer
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -16,4 +16,4 @@ sealed class Result: X {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class Container(val r: Result)
|
class Container(val r: Result)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE,-OPT_IN_USAGE_ERROR,-OPT_IN_USAGE
|
// !DIAGNOSTICS: -OPT_IN_USAGE_ERROR, -OPT_IN_USAGE
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
// SKIP_TXT
|
// SKIP_TXT
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,3 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -15,4 +14,4 @@ class NopeNullableSerializer: KSerializer<Nope?> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class Foo(val foo: <!SERIALIZER_NULLABILITY_INCOMPATIBLE("NopeNullableSerializer", "Nope")!>Nope<!>)
|
class Foo(val foo: <!SERIALIZER_NULLABILITY_INCOMPATIBLE("NopeNullableSerializer; Nope")!>Nope<!>)
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ fun testKinds(): String {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return testData(testKinds())
|
return testData(testKinds())
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -20,4 +20,4 @@ fun box(): String {
|
|||||||
val decoded = Json.decodeFromString(serial, s)
|
val decoded = Json.decodeFromString(serial, s)
|
||||||
if (box.t != decoded.t || box.vs != decoded.vs) return "Incorrect deserialization"
|
if (box.t != decoded.t || box.vs != decoded.vs) return "Incorrect deserialization"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ fun test(targetString: String): String {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return test("""{"ctor":1,"ctorDependent":2,"body":"x","bodyDependent":3}""")
|
return test("""{"ctor":1,"ctorDependent":2,"body":"x","bodyDependent":3}""")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,4 +42,4 @@ fun testSerialization(previous: String): String {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return testSerialization(testSerializers())
|
return testSerialization(testSerializers())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ fun box(): String {
|
|||||||
val s = Json.encodeToString(Holder.serializer(), Holder(Foo(42)))
|
val s = Json.encodeToString(Holder.serializer(), Holder(Foo(42)))
|
||||||
if (s != """{"f":42}""") return s
|
if (s != """{"f":42}""") return s
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,4 @@ fun test(targetString: String): String {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return test("""{"ctor":1,"body":"x"}""")
|
return test("""{"ctor":1,"body":"x"}""")
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -34,4 +34,4 @@ fun test(targetString: String): String {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return test("""{"ctor":42,"body":"42"}""")
|
return test("""{"ctor":42,"body":"42"}""")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ fun box(): String {
|
|||||||
val decoded = Json.decodeFromString(FooBar.serializer(), encoded)
|
val decoded = Json.decodeFromString(FooBar.serializer(), encoded)
|
||||||
if (decoded !== FooBar) return "Incorrect object instance"
|
if (decoded !== FooBar) return "Incorrect object instance"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
-81
@@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2022 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.kotlinx.serialization;
|
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
|
||||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
|
||||||
import org.jetbrains.kotlin.test.TargetBackend;
|
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
|
||||||
import org.junit.jupiter.api.Nested;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
@TestMetadata("plugins/kotlinx-serialization/testData/firMembers")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
public class SerializationFirBlackBoxTestGenerated extends AbstractSerializationFirBlackBoxTest {
|
|
||||||
@Test
|
|
||||||
@TestMetadata("abstractAndSealed.kt")
|
|
||||||
public void testAbstractAndSealed() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/abstractAndSealed.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAllFilesPresentInFirMembers() throws Exception {
|
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/firMembers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("classWithCompanionObject.kt")
|
|
||||||
public void testClassWithCompanionObject() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/classWithCompanionObject.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("classWithGenericParameters.kt")
|
|
||||||
public void testClassWithGenericParameters() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/classWithGenericParameters.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("defaultProperties.kt")
|
|
||||||
public void testDefaultProperties() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/defaultProperties.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("enums.kt")
|
|
||||||
public void testEnums() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/enums.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("inlineClasses.kt")
|
|
||||||
public void testInlineClasses() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/inlineClasses.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("multipleProperties.kt")
|
|
||||||
public void testMultipleProperties() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/multipleProperties.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("privatePropertiesSerialization.kt")
|
|
||||||
public void testPrivatePropertiesSerialization() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/privatePropertiesSerialization.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("serializableObject.kt")
|
|
||||||
public void testSerializableObject() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/serializableObject.kt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-80
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2022 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.kotlinx.serialization;
|
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
|
||||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
|
||||||
import org.junit.jupiter.api.Nested;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
@TestMetadata("plugins/kotlinx-serialization/testData/firMembers")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
public class SerializationFirMembersTestGenerated extends AbstractSerializationFirMembersTest {
|
|
||||||
@Test
|
|
||||||
@TestMetadata("abstractAndSealed.kt")
|
|
||||||
public void testAbstractAndSealed() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/abstractAndSealed.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAllFilesPresentInFirMembers() throws Exception {
|
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/firMembers"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("classWithCompanionObject.kt")
|
|
||||||
public void testClassWithCompanionObject() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/classWithCompanionObject.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("classWithGenericParameters.kt")
|
|
||||||
public void testClassWithGenericParameters() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/classWithGenericParameters.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("defaultProperties.kt")
|
|
||||||
public void testDefaultProperties() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/defaultProperties.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("enums.kt")
|
|
||||||
public void testEnums() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/enums.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("inlineClasses.kt")
|
|
||||||
public void testInlineClasses() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/inlineClasses.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("multipleProperties.kt")
|
|
||||||
public void testMultipleProperties() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/multipleProperties.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("privatePropertiesSerialization.kt")
|
|
||||||
public void testPrivatePropertiesSerialization() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/privatePropertiesSerialization.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("serializableObject.kt")
|
|
||||||
public void testSerializableObject() throws Exception {
|
|
||||||
runTest("plugins/kotlinx-serialization/testData/firMembers/serializableObject.kt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+11
-12
@@ -3,42 +3,41 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.kotlinx.serialization;
|
package org.jetbrains.kotlinx.serialization.runners;
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
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.util.KtTestUtil;
|
||||||
|
import org.jetbrains.kotlin.test.TargetBackend;
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@TestMetadata("plugins/kotlinx-serialization/testData/codegen")
|
@TestMetadata("plugins/kotlinx-serialization/testData/codegen")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
public class SerializationAsmLikeInstructionsListingTestGenerated extends AbstractSerializationAsmLikeInstructionsListingTest {
|
||||||
public class SerializationIrBytecodeListingTestGenerated extends AbstractSerializationIrBytecodeListingTest {
|
@Test
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInCodegen() throws Exception {
|
public void testAllFilesPresentInCodegen() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/codegen"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/codegen"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("Basic.kt")
|
@TestMetadata("Basic.kt")
|
||||||
public void testBasic() throws Exception {
|
public void testBasic() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/codegen/Basic.kt");
|
runTest("plugins/kotlinx-serialization/testData/codegen/Basic.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("Delegated.kt")
|
@TestMetadata("Delegated.kt")
|
||||||
public void testDelegated() throws Exception {
|
public void testDelegated() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/codegen/Delegated.kt");
|
runTest("plugins/kotlinx-serialization/testData/codegen/Delegated.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("Sealed.kt")
|
@TestMetadata("Sealed.kt")
|
||||||
public void testSealed() throws Exception {
|
public void testSealed() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/codegen/Sealed.kt");
|
runTest("plugins/kotlinx-serialization/testData/codegen/Sealed.kt");
|
||||||
+142
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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.kotlinx.serialization.runners;
|
||||||
|
|
||||||
|
import com.intellij.testFramework.TestDataPath;
|
||||||
|
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||||
|
import org.jetbrains.kotlin.test.TargetBackend;
|
||||||
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
public class SerializationFirBlackBoxTestGenerated extends AbstractSerializationFirBlackBoxTest {
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("plugins/kotlinx-serialization/testData/boxIr")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class BoxIr {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInBoxIr() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/boxIr"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("annotationsOnFile.kt")
|
||||||
|
public void testAnnotationsOnFile() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/annotationsOnFile.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("classSerializerAsObject.kt")
|
||||||
|
public void testClassSerializerAsObject() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/classSerializerAsObject.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enumsAreCached.kt")
|
||||||
|
public void testEnumsAreCached() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/enumsAreCached.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("generics.kt")
|
||||||
|
public void testGenerics() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/generics.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inlineClasses.kt")
|
||||||
|
public void testInlineClasses() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/inlineClasses.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("metaSerializable.kt")
|
||||||
|
public void testMetaSerializable() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/metaSerializable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("multimoduleInheritance.kt")
|
||||||
|
public void testMultimoduleInheritance() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/multimoduleInheritance.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("sealedInterfaces.kt")
|
||||||
|
public void testSealedInterfaces() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/boxIr/sealedInterfaces.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("plugins/kotlinx-serialization/testData/firMembers")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class FirMembers {
|
||||||
|
@Test
|
||||||
|
@TestMetadata("abstractAndSealed.kt")
|
||||||
|
public void testAbstractAndSealed() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/abstractAndSealed.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInFirMembers() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/firMembers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("classWithCompanionObject.kt")
|
||||||
|
public void testClassWithCompanionObject() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/classWithCompanionObject.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("classWithGenericParameters.kt")
|
||||||
|
public void testClassWithGenericParameters() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/classWithGenericParameters.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("defaultProperties.kt")
|
||||||
|
public void testDefaultProperties() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/defaultProperties.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enums.kt")
|
||||||
|
public void testEnums() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/enums.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inlineClasses.kt")
|
||||||
|
public void testInlineClasses() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/inlineClasses.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("multipleProperties.kt")
|
||||||
|
public void testMultipleProperties() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/multipleProperties.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("privatePropertiesSerialization.kt")
|
||||||
|
public void testPrivatePropertiesSerialization() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/privatePropertiesSerialization.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("serializableObject.kt")
|
||||||
|
public void testSerializableObject() throws Exception {
|
||||||
|
runTest("plugins/kotlinx-serialization/testData/firMembers/serializableObject.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-12
@@ -3,42 +3,41 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.kotlinx.serialization;
|
package org.jetbrains.kotlinx.serialization.runners;
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
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.util.KtTestUtil;
|
||||||
|
import org.jetbrains.kotlin.test.TargetBackend;
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@TestMetadata("plugins/kotlinx-serialization/testData/codegen")
|
@TestMetadata("plugins/kotlinx-serialization/testData/codegen")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
public class SerializationIrAsmLikeInstructionsListingTestGenerated extends AbstractSerializationIrAsmLikeInstructionsListingTest {
|
||||||
public class SerializationPluginBytecodeListingTestGenerated extends AbstractSerializationPluginBytecodeListingTest {
|
@Test
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
|
||||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInCodegen() throws Exception {
|
public void testAllFilesPresentInCodegen() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/codegen"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/codegen"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("Basic.kt")
|
@TestMetadata("Basic.kt")
|
||||||
public void testBasic() throws Exception {
|
public void testBasic() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/codegen/Basic.kt");
|
runTest("plugins/kotlinx-serialization/testData/codegen/Basic.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("Delegated.kt")
|
@TestMetadata("Delegated.kt")
|
||||||
public void testDelegated() throws Exception {
|
public void testDelegated() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/codegen/Delegated.kt");
|
runTest("plugins/kotlinx-serialization/testData/codegen/Delegated.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("Sealed.kt")
|
@TestMetadata("Sealed.kt")
|
||||||
public void testSealed() throws Exception {
|
public void testSealed() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/codegen/Sealed.kt");
|
runTest("plugins/kotlinx-serialization/testData/codegen/Sealed.kt");
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.kotlinx.serialization;
|
package org.jetbrains.kotlinx.serialization.runners;
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
import com.intellij.testFramework.TestDataPath;
|
||||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||||
+23
-11
@@ -3,112 +3,124 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.kotlinx.serialization;
|
package org.jetbrains.kotlinx.serialization.runners;
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
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.util.KtTestUtil;
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@TestMetadata("plugins/kotlinx-serialization/testData/diagnostics")
|
@TestMetadata("plugins/kotlinx-serialization/testData/diagnostics")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public class SerializationPluginDiagnosticTestGenerated extends AbstractSerializationPluginDiagnosticTest {
|
public class SerializationPluginDiagnosticTestGenerated extends AbstractSerializationPluginDiagnosticTest {
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
@Test
|
||||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInDiagnostics() throws Exception {
|
public void testAllFilesPresentInDiagnostics() throws Exception {
|
||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("DuplicateSerialName.kt")
|
@TestMetadata("DuplicateSerialName.kt")
|
||||||
public void testDuplicateSerialName() throws Exception {
|
public void testDuplicateSerialName() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/DuplicateSerialName.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/DuplicateSerialName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("EnumDuplicateSerialName.kt")
|
@TestMetadata("EnumDuplicateSerialName.kt")
|
||||||
public void testEnumDuplicateSerialName() throws Exception {
|
public void testEnumDuplicateSerialName() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/EnumDuplicateSerialName.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/EnumDuplicateSerialName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("ExternalSerializers.kt")
|
@TestMetadata("ExternalSerializers.kt")
|
||||||
public void testExternalSerializers() throws Exception {
|
public void testExternalSerializers() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/ExternalSerializers.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/ExternalSerializers.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("IncorrectTransient.kt")
|
@TestMetadata("IncorrectTransient.kt")
|
||||||
public void testIncorrectTransient() throws Exception {
|
public void testIncorrectTransient() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/IncorrectTransient.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/IncorrectTransient.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("IncorrectTransient2.kt")
|
@TestMetadata("IncorrectTransient2.kt")
|
||||||
public void testIncorrectTransient2() throws Exception {
|
public void testIncorrectTransient2() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/IncorrectTransient2.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/IncorrectTransient2.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("InheritableInfo.kt")
|
@TestMetadata("InheritableInfo.kt")
|
||||||
public void testInheritableInfo() throws Exception {
|
public void testInheritableInfo() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/InheritableInfo.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/InheritableInfo.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("LazyRecursionBug.kt")
|
@TestMetadata("LazyRecursionBug.kt")
|
||||||
public void testLazyRecursionBug() throws Exception {
|
public void testLazyRecursionBug() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/LazyRecursionBug.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/LazyRecursionBug.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("LocalAndAnonymous.kt")
|
@TestMetadata("LocalAndAnonymous.kt")
|
||||||
public void testLocalAndAnonymous() throws Exception {
|
public void testLocalAndAnonymous() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/LocalAndAnonymous.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/LocalAndAnonymous.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("NoSuitableCtorInParent.kt")
|
@TestMetadata("NoSuitableCtorInParent.kt")
|
||||||
public void testNoSuitableCtorInParent() throws Exception {
|
public void testNoSuitableCtorInParent() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/NoSuitableCtorInParent.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/NoSuitableCtorInParent.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("NonSerializable.kt")
|
@TestMetadata("NonSerializable.kt")
|
||||||
public void testNonSerializable() throws Exception {
|
public void testNonSerializable() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/NonSerializable.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/NonSerializable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("NullabilityIncompatible.kt")
|
@TestMetadata("NullabilityIncompatible.kt")
|
||||||
public void testNullabilityIncompatible() throws Exception {
|
public void testNullabilityIncompatible() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/NullabilityIncompatible.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/NullabilityIncompatible.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("ParamIsNotProperty.kt")
|
@TestMetadata("ParamIsNotProperty.kt")
|
||||||
public void testParamIsNotProperty() throws Exception {
|
public void testParamIsNotProperty() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/ParamIsNotProperty.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/ParamIsNotProperty.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("SerializableEnums.kt")
|
@TestMetadata("SerializableEnums.kt")
|
||||||
public void testSerializableEnums() throws Exception {
|
public void testSerializableEnums() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializableEnums.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializableEnums.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("SerializableIgnored.kt")
|
@TestMetadata("SerializableIgnored.kt")
|
||||||
public void testSerializableIgnored() throws Exception {
|
public void testSerializableIgnored() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializableIgnored.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializableIgnored.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("SerializerTypeCompatibleForSpecials.kt")
|
@TestMetadata("SerializerTypeCompatibleForSpecials.kt")
|
||||||
public void testSerializerTypeCompatibleForSpecials() throws Exception {
|
public void testSerializerTypeCompatibleForSpecials() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializerTypeCompatibleForSpecials.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializerTypeCompatibleForSpecials.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("SerializerTypeIncompatible.kt")
|
@TestMetadata("SerializerTypeIncompatible.kt")
|
||||||
public void testSerializerTypeIncompatible() throws Exception {
|
public void testSerializerTypeIncompatible() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializerTypeIncompatible.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/SerializerTypeIncompatible.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
@TestMetadata("Transients.kt")
|
@TestMetadata("Transients.kt")
|
||||||
public void testTransients() throws Exception {
|
public void testTransients() throws Exception {
|
||||||
runTest("plugins/kotlinx-serialization/testData/diagnostics/Transients.kt");
|
runTest("plugins/kotlinx-serialization/testData/diagnostics/Transients.kt");
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.kotlinx.serialization;
|
package org.jetbrains.kotlinx.serialization.runners;
|
||||||
|
|
||||||
import com.intellij.testFramework.TestDataPath;
|
import com.intellij.testFramework.TestDataPath;
|
||||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||||
-79
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2022 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.kotlinx.serialization
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter
|
|
||||||
import org.jetbrains.kotlin.test.TargetBackend
|
|
||||||
import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor
|
|
||||||
import org.jetbrains.kotlin.test.backend.handlers.IrTextDumpHandler
|
|
||||||
import org.jetbrains.kotlin.test.backend.handlers.IrTreeVerifierHandler
|
|
||||||
import org.jetbrains.kotlin.test.backend.handlers.JvmBoxRunner
|
|
||||||
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
|
|
||||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
|
||||||
import org.jetbrains.kotlin.test.builders.fir2IrStep
|
|
||||||
import org.jetbrains.kotlin.test.builders.irHandlersStep
|
|
||||||
import org.jetbrains.kotlin.test.builders.jvmArtifactsHandlersStep
|
|
||||||
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives
|
|
||||||
import org.jetbrains.kotlin.test.model.TestModule
|
|
||||||
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
|
|
||||||
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest
|
|
||||||
import org.jetbrains.kotlin.test.runners.baseFirDiagnosticTestConfiguration
|
|
||||||
import org.jetbrains.kotlin.test.services.RuntimeClasspathProvider
|
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.fir.FirSerializationExtensionRegistrar
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class AbstractSerializationFirMembersTest: AbstractKotlinCompilerTest() {
|
|
||||||
private val librariesList = listOf(getSerializationCoreLibraryJar()!!, getSerializationLibraryJar("kotlinx.serialization.json.Json")!!)
|
|
||||||
|
|
||||||
override fun TestConfigurationBuilder.configuration() {
|
|
||||||
baseFirDiagnosticTestConfiguration()
|
|
||||||
|
|
||||||
defaultDirectives {
|
|
||||||
+FirDiagnosticsDirectives.ENABLE_PLUGIN_PHASES
|
|
||||||
+FirDiagnosticsDirectives.FIR_DUMP
|
|
||||||
}
|
|
||||||
|
|
||||||
configureForKotlinxSerialization(librariesList) {
|
|
||||||
FirExtensionRegistrarAdapter.registerExtension(FirSerializationExtensionRegistrar())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open class AbstractSerializationFirBlackBoxTest : AbstractKotlinCompilerWithTargetBackendTest(TargetBackend.JVM_IR) {
|
|
||||||
|
|
||||||
private val librariesList = listOf(getSerializationCoreLibraryJar()!!, getSerializationLibraryJar("kotlinx.serialization.json.Json")!!)
|
|
||||||
|
|
||||||
override fun TestConfigurationBuilder.configuration() {
|
|
||||||
baseFirDiagnosticTestConfiguration()
|
|
||||||
configureForKotlinxSerialization(librariesList) {
|
|
||||||
FirExtensionRegistrarAdapter.registerExtension(FirSerializationExtensionRegistrar())
|
|
||||||
}
|
|
||||||
useCustomRuntimeClasspathProviders({ ts ->
|
|
||||||
object : RuntimeClasspathProvider(ts) {
|
|
||||||
override fun runtimeClassPaths(module: TestModule): List<File> {
|
|
||||||
return librariesList
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
defaultDirectives {
|
|
||||||
+FirDiagnosticsDirectives.ENABLE_PLUGIN_PHASES
|
|
||||||
}
|
|
||||||
|
|
||||||
fir2IrStep()
|
|
||||||
irHandlersStep {
|
|
||||||
useHandlers(
|
|
||||||
::IrTextDumpHandler,
|
|
||||||
::IrTreeVerifierHandler,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
facadeStep(::JvmIrBackendFacade)
|
|
||||||
jvmArtifactsHandlersStep {
|
|
||||||
useHandlers(::JvmBoxRunner)
|
|
||||||
}
|
|
||||||
|
|
||||||
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +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.kotlinx.serialization
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
|
||||||
import org.jetbrains.kotlin.test.runners.codegen.AbstractIrBlackBoxCodegenTest
|
|
||||||
|
|
||||||
open class AbstractSerializationIrBoxTest : AbstractIrBlackBoxCodegenTest() {
|
|
||||||
private val coreLibraryPath = getSerializationCoreLibraryJar()
|
|
||||||
private val jsonLibraryPath = getSerializationLibraryJar("kotlinx.serialization.json.Json")
|
|
||||||
|
|
||||||
override fun configure(builder: TestConfigurationBuilder) {
|
|
||||||
super.configure(builder)
|
|
||||||
val librariesPaths = listOf(coreLibraryPath!!, jsonLibraryPath!!)
|
|
||||||
builder.configureForKotlinxSerialization(librariesPaths)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-33
@@ -1,33 +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.kotlinx.serialization
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
|
|
||||||
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
|
|
||||||
import org.jetbrains.kotlin.compiler.plugin.registerExtensionsForTest
|
|
||||||
import org.jetbrains.kotlin.test.TargetBackend
|
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
@OptIn(ObsoleteTestInfrastructure::class)
|
|
||||||
abstract class AbstractSerializationIrBytecodeListingTest : AbstractAsmLikeInstructionListingTest() {
|
|
||||||
private val coreLibraryPath = getSerializationCoreLibraryJar()
|
|
||||||
|
|
||||||
override fun getExpectedTextFileName(wholeFile: File): String {
|
|
||||||
return wholeFile.nameWithoutExtension + ".ir.txt"
|
|
||||||
}
|
|
||||||
|
|
||||||
override val backend = TargetBackend.JVM_IR
|
|
||||||
|
|
||||||
override fun setupEnvironment(environment: KotlinCoreEnvironment) {
|
|
||||||
registerExtensionsForTest(environment.project, environment.configuration) {
|
|
||||||
SerializationComponentRegistrar.registerExtensions(this)
|
|
||||||
}
|
|
||||||
environment.updateClasspath(listOf(JvmClasspathRoot(coreLibraryPath!!)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-25
@@ -1,25 +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.kotlinx.serialization
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
|
|
||||||
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
|
|
||||||
import org.jetbrains.kotlin.compiler.plugin.registerExtensionsForTest
|
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
|
|
||||||
|
|
||||||
@OptIn(ObsoleteTestInfrastructure::class)
|
|
||||||
abstract class AbstractSerializationPluginBytecodeListingTest : AbstractAsmLikeInstructionListingTest() {
|
|
||||||
private val coreLibraryPath = getSerializationCoreLibraryJar()
|
|
||||||
|
|
||||||
override fun setupEnvironment(environment: KotlinCoreEnvironment) {
|
|
||||||
registerExtensionsForTest(environment.project, environment.configuration) {
|
|
||||||
SerializationComponentRegistrar.registerExtensions(this)
|
|
||||||
}
|
|
||||||
environment.updateClasspath(listOf(JvmClasspathRoot(coreLibraryPath!!)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-25
@@ -1,25 +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.kotlinx.serialization
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
|
|
||||||
import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTest
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
|
|
||||||
import org.jetbrains.kotlin.compiler.plugin.registerExtensionsForTest
|
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
|
|
||||||
|
|
||||||
@OptIn(ObsoleteTestInfrastructure::class)
|
|
||||||
abstract class AbstractSerializationPluginDiagnosticTest : AbstractDiagnosticsTest() {
|
|
||||||
private val coreLibraryPath = getSerializationCoreLibraryJar()
|
|
||||||
|
|
||||||
override fun setupEnvironment(environment: KotlinCoreEnvironment) {
|
|
||||||
registerExtensionsForTest(environment.project, environment.configuration) {
|
|
||||||
SerializationComponentRegistrar.registerExtensions(this)
|
|
||||||
}
|
|
||||||
environment.updateClasspath(listOf(JvmClasspathRoot(coreLibraryPath!!)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +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.kotlinx.serialization
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
|
||||||
import org.jetbrains.kotlin.test.runners.codegen.AbstractIrBlackBoxCodegenTest
|
|
||||||
|
|
||||||
open class AbstractSerializationWithoutRuntimeIrBoxTest : AbstractIrBlackBoxCodegenTest() {
|
|
||||||
override fun configure(builder: TestConfigurationBuilder) {
|
|
||||||
super.configure(builder)
|
|
||||||
builder.configureForKotlinxSerialization(emptyList())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+15
-49
@@ -5,29 +5,30 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlinx.serialization
|
package org.jetbrains.kotlinx.serialization
|
||||||
|
|
||||||
import junit.framework.TestCase
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
|
|
||||||
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar.ExtensionStorage
|
|
||||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
|
||||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
|
||||||
import org.jetbrains.kotlin.test.model.TestModule
|
|
||||||
import org.jetbrains.kotlin.test.services.EnvironmentConfigurator
|
|
||||||
import org.jetbrains.kotlin.test.services.RuntimeClasspathProvider
|
|
||||||
import org.jetbrains.kotlin.utils.PathUtil
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.diagnostic.VersionReader
|
import org.jetbrains.kotlinx.serialization.compiler.diagnostic.VersionReader
|
||||||
import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
|
import org.junit.jupiter.api.Assertions.assertNotNull
|
||||||
import org.junit.Test
|
import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.test.assertTrue
|
|
||||||
|
|
||||||
class RuntimeLibraryInClasspathTest {
|
class RuntimeLibraryInClasspathTest {
|
||||||
private val coreLibraryPath = getSerializationCoreLibraryJar()
|
companion object {
|
||||||
|
val coreLibraryPath = getSerializationLibraryJar("kotlinx.serialization.KSerializer")
|
||||||
|
val jsonLibraryPath = getSerializationLibraryJar("kotlinx.serialization.json.Json")
|
||||||
|
|
||||||
|
private fun getSerializationLibraryJar(classToDetect: String): File? = try {
|
||||||
|
PathUtil.getResourcePathForClass(Class.forName(classToDetect))
|
||||||
|
} catch (e: ClassNotFoundException) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRuntimeLibraryExists() {
|
fun testRuntimeLibraryExists() {
|
||||||
TestCase.assertNotNull(
|
assertNotNull(
|
||||||
|
coreLibraryPath,
|
||||||
"kotlinx-serialization runtime library is not found. Make sure it is present in test classpath",
|
"kotlinx-serialization runtime library is not found. Make sure it is present in test classpath",
|
||||||
coreLibraryPath
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,38 +39,3 @@ class RuntimeLibraryInClasspathTest {
|
|||||||
assertTrue(version.implementationVersionMatchSupported(), "Runtime version too low")
|
assertTrue(version.implementationVersionMatchSupported(), "Runtime version too low")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun getSerializationCoreLibraryJar(): File? = getSerializationLibraryJar("kotlinx.serialization.KSerializer")
|
|
||||||
|
|
||||||
internal fun getSerializationLibraryJar(classToDetect: String): File? = try {
|
|
||||||
PathUtil.getResourcePathForClass(Class.forName(classToDetect))
|
|
||||||
} catch (e: ClassNotFoundException) {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun TestConfigurationBuilder.configureForKotlinxSerialization(librariesPaths: List<File>, registerAdditionalExtensions: ExtensionStorage.() -> Unit = {}) {
|
|
||||||
useConfigurators(
|
|
||||||
{ services ->
|
|
||||||
object : EnvironmentConfigurator(services) {
|
|
||||||
override fun configureCompilerConfiguration(
|
|
||||||
configuration: CompilerConfiguration,
|
|
||||||
module: TestModule
|
|
||||||
) {
|
|
||||||
configuration.addJvmClasspathRoots(librariesPaths)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun ExtensionStorage.registerCompilerExtensions(module: TestModule, configuration: CompilerConfiguration) {
|
|
||||||
SerializationComponentRegistrar.registerExtensions(this)
|
|
||||||
registerAdditionalExtensions()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
useCustomRuntimeClasspathProviders(
|
|
||||||
{
|
|
||||||
object : RuntimeClasspathProvider(it) {
|
|
||||||
override fun runtimeClassPaths(module: TestModule): List<File> = librariesPaths
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|||||||
+23
-28
@@ -6,52 +6,47 @@
|
|||||||
package org.jetbrains.kotlinx.serialization
|
package org.jetbrains.kotlinx.serialization
|
||||||
|
|
||||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
import org.jetbrains.kotlinx.serialization.runners.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
System.setProperty("java.awt.headless", "true")
|
System.setProperty("java.awt.headless", "true")
|
||||||
|
|
||||||
generateTestGroupSuite {
|
val excludedFirTestdataPattern = "^(.+)\\.fir\\.kts?\$"
|
||||||
testGroup(
|
|
||||||
"plugins/kotlinx-serialization/tests-gen",
|
|
||||||
"plugins/kotlinx-serialization/testData"
|
|
||||||
) {
|
|
||||||
testClass<AbstractSerializationPluginDiagnosticTest> {
|
|
||||||
model("diagnostics")
|
|
||||||
}
|
|
||||||
|
|
||||||
testClass<AbstractSerializationPluginBytecodeListingTest> {
|
|
||||||
model("codegen")
|
|
||||||
}
|
|
||||||
|
|
||||||
testClass<AbstractSerializationIrBytecodeListingTest> {
|
|
||||||
model("codegen")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generateTestGroupSuiteWithJUnit5(args) {
|
generateTestGroupSuiteWithJUnit5(args) {
|
||||||
testGroup(
|
testGroup(
|
||||||
"plugins/kotlinx-serialization/tests-gen",
|
"plugins/kotlinx-serialization/tests-gen",
|
||||||
"plugins/kotlinx-serialization/testData"
|
"plugins/kotlinx-serialization/testData"
|
||||||
) {
|
) {
|
||||||
|
// ------------------------------- diagnostics -------------------------------
|
||||||
|
testClass<AbstractSerializationPluginDiagnosticTest>() {
|
||||||
|
model("diagnostics", excludedPattern = excludedFirTestdataPattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- asm instructions -------------------------------
|
||||||
|
|
||||||
|
testClass<AbstractSerializationAsmLikeInstructionsListingTest> {
|
||||||
|
model("codegen")
|
||||||
|
}
|
||||||
|
|
||||||
|
testClass<AbstractSerializationIrAsmLikeInstructionsListingTest> {
|
||||||
|
model("codegen")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- box -------------------------------
|
||||||
|
|
||||||
// New test infrastructure ONLY
|
|
||||||
testClass<AbstractSerializationIrBoxTest> {
|
testClass<AbstractSerializationIrBoxTest> {
|
||||||
model("boxIr")
|
model("boxIr")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testClass<AbstractSerializationFirBlackBoxTest> {
|
||||||
|
model("boxIr")
|
||||||
|
model("firMembers")
|
||||||
|
}
|
||||||
|
|
||||||
testClass<AbstractSerializationWithoutRuntimeIrBoxTest> {
|
testClass<AbstractSerializationWithoutRuntimeIrBoxTest> {
|
||||||
model("boxWithoutRuntime")
|
model("boxWithoutRuntime")
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractSerializationFirMembersTest> {
|
|
||||||
model("firMembers")
|
|
||||||
}
|
|
||||||
|
|
||||||
testClass<AbstractSerializationFirBlackBoxTest> {
|
|
||||||
model("firMembers")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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.kotlinx.serialization.runners
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||||
|
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives
|
||||||
|
import org.jetbrains.kotlin.test.runners.codegen.AbstractAsmLikeInstructionListingTest
|
||||||
|
import org.jetbrains.kotlin.test.runners.codegen.AbstractIrAsmLikeInstructionListingTest
|
||||||
|
import org.jetbrains.kotlinx.serialization.configureForKotlinxSerialization
|
||||||
|
|
||||||
|
open class AbstractSerializationAsmLikeInstructionsListingTest : AbstractAsmLikeInstructionListingTest() {
|
||||||
|
override fun configure(builder: TestConfigurationBuilder) {
|
||||||
|
super.configure(builder)
|
||||||
|
builder.enableDifference()
|
||||||
|
builder.configureForKotlinxSerialization()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class AbstractSerializationIrAsmLikeInstructionsListingTest : AbstractIrAsmLikeInstructionListingTest() {
|
||||||
|
override fun configure(builder: TestConfigurationBuilder) {
|
||||||
|
super.configure(builder)
|
||||||
|
builder.enableDifference()
|
||||||
|
builder.configureForKotlinxSerialization()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun TestConfigurationBuilder.enableDifference() {
|
||||||
|
defaultDirectives {
|
||||||
|
+AsmLikeInstructionListingDirectives.IR_DIFFERENCE
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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.kotlinx.serialization.runners
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||||
|
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.FIR_DUMP
|
||||||
|
import org.jetbrains.kotlin.test.runners.codegen.AbstractFirBlackBoxCodegenTest
|
||||||
|
import org.jetbrains.kotlin.test.runners.codegen.AbstractIrBlackBoxCodegenTest
|
||||||
|
import org.jetbrains.kotlinx.serialization.configureForKotlinxSerialization
|
||||||
|
|
||||||
|
open class AbstractSerializationIrBoxTest : AbstractIrBlackBoxCodegenTest() {
|
||||||
|
override fun configure(builder: TestConfigurationBuilder) {
|
||||||
|
super.configure(builder)
|
||||||
|
builder.configureForKotlinxSerialization()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class AbstractSerializationWithoutRuntimeIrBoxTest : AbstractIrBlackBoxCodegenTest() {
|
||||||
|
override fun configure(builder: TestConfigurationBuilder) {
|
||||||
|
super.configure(builder)
|
||||||
|
builder.configureForKotlinxSerialization(noLibraries = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class AbstractSerializationFirBlackBoxTest : AbstractFirBlackBoxCodegenTest() {
|
||||||
|
override fun configure(builder: TestConfigurationBuilder) {
|
||||||
|
super.configure(builder)
|
||||||
|
builder.configureForKotlinxSerialization()
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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.kotlinx.serialization.runners
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||||
|
import org.jetbrains.kotlin.test.runners.AbstractDiagnosticTest
|
||||||
|
import org.jetbrains.kotlinx.serialization.configureForKotlinxSerialization
|
||||||
|
|
||||||
|
abstract class AbstractSerializationPluginDiagnosticTest : AbstractDiagnosticTest() {
|
||||||
|
override fun configure(builder: TestConfigurationBuilder) {
|
||||||
|
super.configure(builder)
|
||||||
|
builder.configureForKotlinxSerialization()
|
||||||
|
}
|
||||||
|
}
|
||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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.kotlinx.serialization
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
|
||||||
|
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
|
||||||
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
|
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter
|
||||||
|
import org.jetbrains.kotlin.test.bind
|
||||||
|
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||||
|
import org.jetbrains.kotlin.test.model.TestModule
|
||||||
|
import org.jetbrains.kotlin.test.services.EnvironmentConfigurator
|
||||||
|
import org.jetbrains.kotlin.test.services.RuntimeClasspathProvider
|
||||||
|
import org.jetbrains.kotlin.test.services.TestServices
|
||||||
|
import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
|
||||||
|
import org.jetbrains.kotlinx.serialization.compiler.fir.FirSerializationExtensionRegistrar
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
private val librariesPaths = listOfNotNull(RuntimeLibraryInClasspathTest.coreLibraryPath, RuntimeLibraryInClasspathTest.jsonLibraryPath)
|
||||||
|
|
||||||
|
class SerializationEnvironmentConfigurator(
|
||||||
|
testServices: TestServices,
|
||||||
|
private val noLibraries: Boolean
|
||||||
|
) : EnvironmentConfigurator(testServices) {
|
||||||
|
override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule) {
|
||||||
|
if (noLibraries) return
|
||||||
|
configuration.addJvmClasspathRoots(librariesPaths)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun CompilerPluginRegistrar.ExtensionStorage.registerCompilerExtensions(
|
||||||
|
module: TestModule,
|
||||||
|
configuration: CompilerConfiguration
|
||||||
|
) {
|
||||||
|
SerializationComponentRegistrar.registerExtensions(this)
|
||||||
|
FirExtensionRegistrarAdapter.registerExtension(FirSerializationExtensionRegistrar())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SerializationRuntimeClasspathProvider(testServices: TestServices) : RuntimeClasspathProvider(testServices) {
|
||||||
|
override fun runtimeClassPaths(module: TestModule): List<File> {
|
||||||
|
return librariesPaths
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun TestConfigurationBuilder.configureForKotlinxSerialization(noLibraries: Boolean = false) {
|
||||||
|
useConfigurators(::SerializationEnvironmentConfigurator.bind(noLibraries))
|
||||||
|
if (!noLibraries) {
|
||||||
|
useCustomRuntimeClasspathProviders(::SerializationRuntimeClasspathProvider)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user