Add compiler diagnostic tests for parcelize checkers
This commit is contained in:
committed by
teamcityserver
parent
b84ee64994
commit
40d8451698
@@ -369,6 +369,10 @@ fun main(args: Array<String>) {
|
||||
testClass<AbstractParcelizeIrBytecodeListingTest> {
|
||||
model("codegen")
|
||||
}
|
||||
|
||||
testClass<AbstractParcelizeDiagnosticTest> {
|
||||
model("diagnostics")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("plugins/fir/fir-plugin-prototype/tests-gen", "plugins/fir/fir-plugin-prototype/testData") {
|
||||
|
||||
@@ -11,7 +11,7 @@ class A : Parcelable
|
||||
class B(val firstName: String, val secondName: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class C(val firstName: String, <error descr="[PARCELABLE_CONSTRUCTOR_PARAMETER_SHOULD_BE_VAL_OR_VAR] 'Parcelable' constructor parameter should be 'val' or 'var'">secondName</error>: String) : Parcelable
|
||||
class C(val firstName: String, <!PARCELABLE_CONSTRUCTOR_PARAMETER_SHOULD_BE_VAL_OR_VAR!>secondName<!>: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class D(val firstName: String, vararg val secondName: String) : Parcelable
|
||||
@@ -22,7 +22,7 @@ class E(val firstName: String, val secondName: String) : Parcelable {
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class <error descr="[PARCELABLE_SHOULD_HAVE_PRIMARY_CONSTRUCTOR] 'Parcelable' should have a primary constructor">F</error> : Parcelable {
|
||||
class <!PARCELABLE_SHOULD_HAVE_PRIMARY_CONSTRUCTOR!>F<!> : Parcelable {
|
||||
constructor(a: String) {
|
||||
println(a)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import android.os.Parcel
|
||||
class A(val a: String) : Parcelable {
|
||||
companion object {
|
||||
@JvmField
|
||||
val <error descr="[CREATOR_DEFINITION_IS_NOT_ALLOWED] 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead">CREATOR</error> = object : Parcelable.Creator<A> {
|
||||
val <!CREATOR_DEFINITION_IS_NOT_ALLOWED!>CREATOR<!> = object : Parcelable.Creator<A> {
|
||||
override fun createFromParcel(source: Parcel): A = A("")
|
||||
override fun newArray(size: Int) = arrayOfNulls<A>(size)
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class A(val a: String) : Parcelable {
|
||||
|
||||
@Parcelize
|
||||
class B(val b: String) : Parcelable {
|
||||
companion object <error descr="[CREATOR_DEFINITION_IS_NOT_ALLOWED] 'CREATOR' definition is not allowed. Use 'Parceler' companion object instead">CREATOR</error> : Parcelable.Creator<B> {
|
||||
companion object <!CREATOR_DEFINITION_IS_NOT_ALLOWED!>CREATOR<!> : Parcelable.Creator<B> {
|
||||
override fun createFromParcel(source: Parcel): B = B("")
|
||||
override fun newArray(size: Int) = arrayOfNulls<B>(size)
|
||||
}
|
||||
|
||||
+8
-8
@@ -19,27 +19,27 @@ class StringClassParceler : Parceler<String> {
|
||||
override fun String.write(parcel: Parcel, flags: Int) = TODO()
|
||||
}
|
||||
|
||||
@<error descr="[CLASS_SHOULD_BE_PARCELIZE] Class 'MissingParcelizeAnnotation' should be annotated with '@Parcelize'">TypeParceler</error><String, StringParceler>
|
||||
class MissingParcelizeAnnotation(val a: @WriteWith<StringParceler> String)
|
||||
@<!CLASS_SHOULD_BE_PARCELIZE!>TypeParceler<!><String, StringParceler>
|
||||
class MissingParcelizeAnnotation(val a: @<!CLASS_SHOULD_BE_PARCELIZE!>WriteWith<!><StringParceler> String)
|
||||
|
||||
@Parcelize
|
||||
@TypeParceler<String, StringClassParceler>
|
||||
class ShouldBeClass(val a: @WriteWith<StringClassParceler> String) : Parcelable
|
||||
class ShouldBeClass(val a: @WriteWith<<!PARCELER_SHOULD_BE_OBJECT!>StringClassParceler<!>> String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class Test(
|
||||
val a: @WriteWith<StringParceler> Int,
|
||||
val a: @WriteWith<<!PARCELER_TYPE_INCOMPATIBLE!>StringParceler<!>> Int,
|
||||
val b: @WriteWith<StringParceler> String,
|
||||
val c: @WriteWith<<error descr="[PARCELER_TYPE_INCOMPATIBLE] Parceler type String is incompatible with CharSequence">StringParceler</error>> CharSequence,
|
||||
val c: @WriteWith<<!PARCELER_TYPE_INCOMPATIBLE!>StringParceler<!>> CharSequence,
|
||||
val d: @WriteWith<CharSequenceParceler> String,
|
||||
val e: @WriteWith<CharSequenceParceler> CharSequence
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
@TypeParceler<String, StringParceler>
|
||||
class Test2(@<warning descr="[REDUNDANT_TYPE_PARCELER] This 'TypeParceler' is already provided for Class 'Test2'">TypeParceler</warning><String, StringParceler> val a: String) : Parcelable
|
||||
class Test2(@<!REDUNDANT_TYPE_PARCELER!>TypeParceler<!><String, StringParceler> val a: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
@TypeParceler<<error descr="[DUPLICATING_TYPE_PARCELERS] Duplicating ''TypeParceler'' annotations">String</error>, StringParceler>
|
||||
@TypeParceler<<error descr="[DUPLICATING_TYPE_PARCELERS] Duplicating ''TypeParceler'' annotations">String</error>, CharSequenceParceler>
|
||||
@TypeParceler<<!DUPLICATING_TYPE_PARCELERS!>String<!>, StringParceler>
|
||||
@TypeParceler<<!DUPLICATING_TYPE_PARCELERS!>String<!>, CharSequenceParceler>
|
||||
class Test3(val a: String) : Parcelable
|
||||
|
||||
+3
-3
@@ -6,16 +6,16 @@ import android.os.Parcel
|
||||
|
||||
@Parcelize
|
||||
class A(val a: String) : Parcelable {
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
<!OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED!>override<!> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
override fun describeContents() = 0
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class B(val a: String) : Parcelable {
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead">override</error> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
<!OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED!>override<!> fun writeToParcel(p: Parcel?, flags: Int) {}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class C(val a: String) : Parcelable {
|
||||
<error descr="[OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED] Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead">override</error> fun writeToParcel(p: Parcel, flags: Int) {}
|
||||
<!OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED!>override<!> fun writeToParcel(p: Parcel, flags: Int) {}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ open class Delegate : Parcelable {
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class Test : Parcelable <error descr="[PARCELABLE_DELEGATE_IS_NOT_ALLOWED] Delegating 'Parcelable' is not allowed">by</error> Delegate()
|
||||
class Test : Parcelable <!PARCELABLE_DELEGATE_IS_NOT_ALLOWED!>by<!> Delegate()
|
||||
|
||||
+8
-8
@@ -21,26 +21,26 @@ object Parceler2 : Parceler<List<String>> {
|
||||
}
|
||||
}
|
||||
|
||||
<warning descr="[DEPRECATED_ANNOTATION] Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. Change package to 'kotlin.parcelize'">@Parcelize</warning>
|
||||
<error descr="[FORBIDDEN_DEPRECATED_ANNOTATION] Parceler-related annotations from package 'kotlinx.android.parcel' are forbidden. Change package to 'kotlinx.parcelize'">@TypeParceler<String, <error descr="[UPPER_BOUND_VIOLATED] Type argument is not within its bounds: should be subtype of 'Parceler<in String>'">Parceler2</error>></error>
|
||||
<!DEPRECATED_ANNOTATION!>@Parcelize<!>
|
||||
<!FORBIDDEN_DEPRECATED_ANNOTATION!>@TypeParceler<String, <!UPPER_BOUND_VIOLATED!>Parceler2<!>><!>
|
||||
data class Test(
|
||||
val a: String,
|
||||
val b: <error descr="[FORBIDDEN_DEPRECATED_ANNOTATION] Parceler-related annotations from package 'kotlinx.android.parcel' are forbidden. Change package to 'kotlinx.parcelize'">@WriteWith<Parceler1></error> String,
|
||||
val c: <error descr="[FORBIDDEN_DEPRECATED_ANNOTATION] Parceler-related annotations from package 'kotlinx.android.parcel' are forbidden. Change package to 'kotlinx.parcelize'">@WriteWith<Parceler2></error> List<<error descr="[FORBIDDEN_DEPRECATED_ANNOTATION] Parceler-related annotations from package 'kotlinx.android.parcel' are forbidden. Change package to 'kotlinx.parcelize'">@WriteWith<Parceler1></error> String>
|
||||
val b: <!FORBIDDEN_DEPRECATED_ANNOTATION!>@WriteWith<Parceler1><!> String,
|
||||
val c: <!FORBIDDEN_DEPRECATED_ANNOTATION!>@WriteWith<Parceler2><!> List<<!FORBIDDEN_DEPRECATED_ANNOTATION!>@WriteWith<Parceler1><!> String>
|
||||
) : Parcelable {
|
||||
<warning descr="[DEPRECATED_ANNOTATION] Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. Change package to 'kotlin.parcelize'">@IgnoredOnParcel</warning>
|
||||
<!DEPRECATED_ANNOTATION!>@IgnoredOnParcel<!>
|
||||
val x by lazy { "foo" }
|
||||
}
|
||||
|
||||
interface ParcelerForUser: Parceler<User>
|
||||
|
||||
<warning descr="[DEPRECATED_ANNOTATION] Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. Change package to 'kotlin.parcelize'">@Parcelize</warning>
|
||||
<!DEPRECATED_ANNOTATION!>@Parcelize<!>
|
||||
class User(val name: String) : Parcelable {
|
||||
private companion <error descr="[DEPRECATED_PARCELER] 'kotlinx.android.parcel.Parceler' is deprecated. Use 'kotlinx.parcelize.Parceler' instead">object</error> : ParcelerForUser {
|
||||
private companion <!DEPRECATED_PARCELER!>object<!> : ParcelerForUser {
|
||||
override fun User.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(name)
|
||||
}
|
||||
|
||||
override fun create(parcel: Parcel) = User(parcel.readString()!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ import android.os.Parcelable
|
||||
class User : Parcelable
|
||||
|
||||
@Parcelize
|
||||
class <warning descr="[PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY] The primary constructor is empty, no data will be serialized to 'Parcel'">User2</warning>() : Parcelable
|
||||
class <!PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY!>User2<!>() : Parcelable
|
||||
|
||||
@@ -17,4 +17,4 @@ class Foo(val box: Box): Parcelable {
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
class Foo2(val box: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Box</error>): Parcelable
|
||||
class Foo2(val box: <!PARCELABLE_TYPE_NOT_SUPPORTED!>Box<!>): Parcelable
|
||||
|
||||
@@ -10,22 +10,22 @@ open class Open(val foo: String) : Parcelable
|
||||
class Final(val foo: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_SHOULD_BE_INSTANTIABLE] 'Parcelable' should not be a 'sealed' or 'abstract' class">abstract</error> class Abstract(val foo: String) : Parcelable
|
||||
<!PARCELABLE_SHOULD_BE_INSTANTIABLE!>abstract<!> class Abstract(val foo: String) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_SHOULD_BE_INSTANTIABLE] 'Parcelable' should not be a 'sealed' or 'abstract' class">sealed</error> class Sealed(val foo: String) : Parcelable {
|
||||
sealed class Sealed(val foo: String) : Parcelable {
|
||||
class X : Sealed("")
|
||||
}
|
||||
|
||||
class Outer {
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_CANT_BE_INNER_CLASS] 'Parcelable' can't be an inner class">inner</error> class Inner(val foo: String) : Parcelable
|
||||
<!PARCELABLE_CANT_BE_INNER_CLASS!>inner<!> class Inner(val foo: String) : Parcelable
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
@Parcelize
|
||||
<error descr="[PARCELABLE_CANT_BE_LOCAL_CLASS] 'Parcelable' can't be a local class">object</error> : Parcelable {}
|
||||
<!PARCELABLE_CANT_BE_LOCAL_CLASS!>object<!> : Parcelable {}
|
||||
|
||||
@Parcelize
|
||||
class <error descr="[PARCELABLE_CANT_BE_LOCAL_CLASS] 'Parcelable' can't be a local class"><error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype">Local</error></error> {}
|
||||
class <!NO_PARCELABLE_SUPERTYPE, PARCELABLE_CANT_BE_LOCAL_CLASS!>Local<!> {}
|
||||
}
|
||||
|
||||
@@ -6,32 +6,32 @@ import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class A(val firstName: String) : Parcelable {
|
||||
val <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@IgnoredOnParcel' annotation to remove the warning">secondName</warning>: String = ""
|
||||
val <!PROPERTY_WONT_BE_SERIALIZED!>secondName<!>: String = ""
|
||||
|
||||
val <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@IgnoredOnParcel' annotation to remove the warning">delegated</warning> by lazy { "" }
|
||||
val <!PROPERTY_WONT_BE_SERIALIZED!>delegated<!> by lazy { "" }
|
||||
|
||||
lateinit var <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@IgnoredOnParcel' annotation to remove the warning">lateinit</warning>: String
|
||||
lateinit var <!PROPERTY_WONT_BE_SERIALIZED!>lateinit<!>: String
|
||||
|
||||
val customGetter: String
|
||||
get() = ""
|
||||
|
||||
var customSetter: String
|
||||
get() = ""
|
||||
set(<warning descr="[UNUSED_PARAMETER] Parameter 'v' is never used">v</warning>) {}
|
||||
set(v) {}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
@Suppress("WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET")
|
||||
class B(<warning descr="[INAPPLICABLE_IGNORED_ON_PARCEL_CONSTRUCTOR_PROPERTY] '@IgnoredOnParcel' is inapplicable to properties declared in the primary constructor">@IgnoredOnParcel</warning> val firstName: String) : Parcelable {
|
||||
class B(<!INAPPLICABLE_IGNORED_ON_PARCEL_CONSTRUCTOR_PROPERTY!>@IgnoredOnParcel<!> val firstName: String) : Parcelable {
|
||||
@IgnoredOnParcel
|
||||
var a: String = ""
|
||||
|
||||
@field:IgnoredOnParcel
|
||||
var <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@IgnoredOnParcel' annotation to remove the warning">b</warning>: String = ""
|
||||
var <!PROPERTY_WONT_BE_SERIALIZED!>b<!>: String = ""
|
||||
|
||||
@get:IgnoredOnParcel
|
||||
var c: String = ""
|
||||
|
||||
@set:IgnoredOnParcel
|
||||
var <warning descr="[PROPERTY_WONT_BE_SERIALIZED] Property would not be serialized into a 'Parcel'. Add '@IgnoredOnParcel' annotation to remove the warning">d</warning>: String = ""
|
||||
}
|
||||
var <!PROPERTY_WONT_BE_SERIALIZED!>d<!>: String = ""
|
||||
}
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import android.os.Parcelable
|
||||
@Parcelize
|
||||
class User(
|
||||
val a: String,
|
||||
val b: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any</error>,
|
||||
val c: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Any?</error>,
|
||||
val d: <error descr="[PARCELABLE_TYPE_NOT_SUPPORTED] Type is not directly supported by 'Parcelize'. Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'">Map<Any, String></error>,
|
||||
val b: <!PARCELABLE_TYPE_NOT_SUPPORTED!>Any<!>,
|
||||
val c: <!PARCELABLE_TYPE_NOT_SUPPORTED!>Any?<!>,
|
||||
val d: <!PARCELABLE_TYPE_NOT_SUPPORTED!>Map<Any, String><!>,
|
||||
val e: @RawValue Any?,
|
||||
val f: @RawValue Map<String, Any>,
|
||||
val g: Map<String, @RawValue Any>,
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import kotlinx.parcelize.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
class <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype">Without</error>(val firstName: String, val secondName: String, val age: Int)
|
||||
class <!NO_PARCELABLE_SUPERTYPE!>Without<!>(val firstName: String, val secondName: String, val age: Int)
|
||||
|
||||
@Parcelize
|
||||
class With(val firstName: String, val secondName: String, val age: Int) : Parcelable
|
||||
|
||||
+5
-5
@@ -4,22 +4,22 @@ import kotlinx.parcelize.Parcelize
|
||||
import android.os.Parcelable
|
||||
|
||||
@Parcelize
|
||||
interface <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Intf</error> : Parcelable
|
||||
interface <!PARCELABLE_SHOULD_BE_CLASS!>Intf<!> : Parcelable
|
||||
|
||||
@Parcelize
|
||||
object <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype">Obj</error>
|
||||
object <!NO_PARCELABLE_SUPERTYPE!>Obj<!>
|
||||
|
||||
class A {
|
||||
@Parcelize
|
||||
companion <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype">object</error> {
|
||||
companion <!NO_PARCELABLE_SUPERTYPE!>object<!> {
|
||||
fun foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
enum class <error descr="[NO_PARCELABLE_SUPERTYPE] No 'Parcelable' supertype">Enum</error> {
|
||||
enum class <!NO_PARCELABLE_SUPERTYPE!>Enum<!> {
|
||||
WHITE, BLACK
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
annotation class <error descr="[PARCELABLE_SHOULD_BE_CLASS] 'Parcelable' should be a class">Anno</error>
|
||||
annotation class <!PARCELABLE_SHOULD_BE_CLASS!>Anno<!>
|
||||
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.parcelize.test.runners;
|
||||
|
||||
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/parcelize/parcelize-compiler/testData/diagnostics")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ParcelizeDiagnosticTestGenerated extends AbstractParcelizeDiagnosticTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInDiagnostics() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/parcelize/parcelize-compiler/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constructors.kt")
|
||||
public void testConstructors() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/constructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("customCreator.kt")
|
||||
public void testCustomCreator() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/customCreator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("customParcelers.kt")
|
||||
public void testCustomParcelers() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/customParcelers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("customWriteToParcel.kt")
|
||||
public void testCustomWriteToParcel() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/customWriteToParcel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegate.kt")
|
||||
public void testDelegate() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/delegate.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("deprecatedAnnotations.kt")
|
||||
public void testDeprecatedAnnotations() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/deprecatedAnnotations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyPrimaryConstructor.kt")
|
||||
public void testEmptyPrimaryConstructor() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/emptyPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt20062.kt")
|
||||
public void testKt20062() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/kt20062.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("modality.kt")
|
||||
public void testModality() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/modality.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notMagicParcel.kt")
|
||||
public void testNotMagicParcel() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/notMagicParcel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("properties.kt")
|
||||
public void testProperties() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/properties.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/simple.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsupportedType.kt")
|
||||
public void testUnsupportedType() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/unsupportedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("withoutParcelableSupertype.kt")
|
||||
public void testWithoutParcelableSupertype() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/withoutParcelableSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("wrongAnnotationTarget.kt")
|
||||
public void testWrongAnnotationTarget() throws Exception {
|
||||
runTest("plugins/parcelize/parcelize-compiler/testData/diagnostics/wrongAnnotationTarget.kt");
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.parcelize.test.runners
|
||||
|
||||
import org.jetbrains.kotlin.parcelize.test.services.ParcelizeEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.test.bind
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.builders.classicFrontendHandlersStep
|
||||
import org.jetbrains.kotlin.test.builders.classicFrontendStep
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.DIAGNOSTICS
|
||||
import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_JVM_DIAGNOSTICS_ON_FRONTEND
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING
|
||||
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
|
||||
import org.jetbrains.kotlin.test.model.DependencyKind
|
||||
import org.jetbrains.kotlin.test.model.FrontendKinds
|
||||
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
|
||||
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
|
||||
|
||||
abstract class AbstractParcelizeDiagnosticTest : AbstractKotlinCompilerTest() {
|
||||
override fun TestConfigurationBuilder.configuration() {
|
||||
globalDefaults {
|
||||
frontend = FrontendKinds.ClassicFrontend
|
||||
targetPlatform = JvmPlatforms.defaultJvmPlatform
|
||||
dependencyKind = DependencyKind.Source
|
||||
}
|
||||
|
||||
defaultDirectives {
|
||||
+USE_PSI_CLASS_FILES_READING
|
||||
+REPORT_JVM_DIAGNOSTICS_ON_FRONTEND
|
||||
DIAGNOSTICS with "-UNUSED_PARAMETER"
|
||||
}
|
||||
|
||||
enableMetaInfoHandler()
|
||||
|
||||
useConfigurators(
|
||||
::CommonEnvironmentConfigurator,
|
||||
::JvmEnvironmentConfigurator,
|
||||
::ParcelizeEnvironmentConfigurator.bind(false)
|
||||
)
|
||||
|
||||
classicFrontendStep()
|
||||
|
||||
classicFrontendHandlersStep {
|
||||
useHandlers(::ClassicDiagnosticsHandler)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user