[MPP] Add tests for const vs non-const expect and actual properties
KT-18856
This commit is contained in:
committed by
TeamCityServer
parent
b2543b7a26
commit
a46e683c85
+56
@@ -0,0 +1,56 @@
|
||||
// MODULE: m1-common
|
||||
|
||||
expect class NonConstNonConst {
|
||||
companion object {
|
||||
val prop: Int
|
||||
}
|
||||
}
|
||||
|
||||
expect class NonConstConst {
|
||||
companion object {
|
||||
val prop: Int
|
||||
}
|
||||
}
|
||||
|
||||
expect class ConstNonConst {
|
||||
companion object {
|
||||
<!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val prop: Int
|
||||
}
|
||||
}
|
||||
|
||||
expect class ConstConst {
|
||||
companion object {
|
||||
<!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val prop: Int
|
||||
}
|
||||
}
|
||||
|
||||
expect val NonConstNonConstTl: Int
|
||||
expect val NonConstConstTl: Int
|
||||
expect <!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val ConstNonConstTl: Int
|
||||
expect <!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val ConstConstTl: Int
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
|
||||
class NonConstImpl {
|
||||
companion object {
|
||||
val prop: Int get() = 42
|
||||
}
|
||||
}
|
||||
|
||||
class ConstImpl {
|
||||
companion object {
|
||||
const val prop: Int = 42
|
||||
}
|
||||
}
|
||||
|
||||
// actuals
|
||||
|
||||
actual typealias NonConstNonConst = NonConstImpl
|
||||
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>NonConstConst<!> = ConstImpl
|
||||
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>ConstNonConst<!> = NonConstImpl
|
||||
actual typealias ConstConst = ConstImpl
|
||||
|
||||
actual val NonConstNonConstTl: Int get() = 42
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual const<!> val NonConstConstTl: Int = 42
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual<!> val ConstNonConstTl: Int get() = 42
|
||||
actual const val ConstConstTl: Int = 42
|
||||
+16
@@ -24,6 +24,22 @@ public class DiagnosticsWithMultiplatformCompositeAnalysisTestGenerated extends
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/constVals")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ConstVals {
|
||||
@Test
|
||||
public void testAllFilesPresentInConstVals() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/constVals"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonConstExpectConstActual.kt")
|
||||
public void testNonConstExpectConstActual() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/constVals/nonConstExpectConstActual.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user