Add test for KT-35957

This commit is contained in:
Alexey Tsvetkov
2020-04-17 12:37:11 +03:00
parent 876d6d209f
commit 2442abadc3
9 changed files with 101 additions and 28 deletions
@@ -16,51 +16,85 @@ import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("jps-plugin/testData/incremental/mpp/allPlatforms")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class IncrementalMultiplatformJvmCompilerRunnerTestGenerated extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInAllPlatforms() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/allPlatforms"), Pattern.compile("^([^\\.]+)$"), null, true);
}
@TestMetadata("touchActual")
public void testTouchActual() throws Exception {
runTest("jps-plugin/testData/incremental/mpp/allPlatforms/touchActual/");
}
@TestMetadata("touchExpect")
public void testTouchExpect() throws Exception {
runTest("jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect/");
}
@TestMetadata("jps-plugin/testData/incremental/mpp/allPlatforms/touchActual")
@TestMetadata("jps-plugin/testData/incremental/mpp/allPlatforms")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TouchActual extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
public static class AllPlatforms extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTouchActual() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/allPlatforms/touchActual"), Pattern.compile("^([^\\.]+)$"), null, true);
public void testAllFilesPresentInAllPlatforms() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/allPlatforms"), Pattern.compile("^([^\\.]+)$"), null, true);
}
@TestMetadata("touchActual")
public void testTouchActual() throws Exception {
runTest("jps-plugin/testData/incremental/mpp/allPlatforms/touchActual/");
}
@TestMetadata("touchExpect")
public void testTouchExpect() throws Exception {
runTest("jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect/");
}
@TestMetadata("jps-plugin/testData/incremental/mpp/allPlatforms/touchActual")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TouchActual extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTouchActual() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/allPlatforms/touchActual"), Pattern.compile("^([^\\.]+)$"), null, true);
}
}
@TestMetadata("jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TouchExpect extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTouchExpect() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect"), Pattern.compile("^([^\\.]+)$"), null, true);
}
}
}
@TestMetadata("jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect")
@TestMetadata("jps-plugin/testData/incremental/mpp/jvmOnly")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TouchExpect extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
public static class JvmOnly extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTouchExpect() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect"), Pattern.compile("^([^\\.]+)$"), null, true);
public void testAllFilesPresentInJvmOnly() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/jvmOnly"), Pattern.compile("^([^\\.]+)$"), null, true);
}
@TestMetadata("multifilePartChanged")
public void testMultifilePartChanged() throws Exception {
runTest("jps-plugin/testData/incremental/mpp/jvmOnly/multifilePartChanged/");
}
@TestMetadata("jps-plugin/testData/incremental/mpp/jvmOnly/multifilePartChanged")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class MultifilePartChanged extends AbstractIncrementalMultiplatformJvmCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInMultifilePartChanged() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps-plugin/testData/incremental/mpp/jvmOnly/multifilePartChanged"), Pattern.compile("^([^\\.]+)$"), null, true);
}
}
}
}
@@ -1297,6 +1297,7 @@ fun main(args: Array<String>) {
testClass<AbstractIncrementalMultiplatformJvmCompilerRunnerTest> {
model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true)
model("incremental/mpp/jvmOnly", extension = null, excludeParentDirs = true)
}
testClass<AbstractIncrementalMultiplatformJsCompilerRunnerTest> {
model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true)
@@ -0,0 +1,4 @@
actual class X {
actual fun foo(): Any = 0
fun bar(): Any = 1
}
@@ -0,0 +1,14 @@
================ Step #1 =================
Compiling files:
src/X.kt
src/commonX.kt
src/utilsActual.kt
src/utilsNoActual.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Class 'X' has several compatible actual declarations in modules <multifilePartChanged>, <multifilePartChanged>
Function 'foo' has several compatible actual declarations in modules <multifilePartChanged>, <multifilePartChanged>
Function 'useX' has several compatible actual declarations in modules <multifilePartChanged>, <multifilePartChanged>
@@ -0,0 +1,5 @@
expect class X {
fun foo(): Any
}
expect fun useX(x: X): Any
@@ -0,0 +1 @@
fun dummy() {}
@@ -0,0 +1,4 @@
@file:JvmMultifileClass
@file:JvmName("Utils")
actual fun useX(x: X): Any = x.foo()
@@ -0,0 +1,6 @@
@file:JvmMultifileClass
@file:JvmName("Utils")
actual fun useX(x: X): Any = x.foo()
fun newFun() = 1
@@ -0,0 +1,4 @@
@file:JvmMultifileClass
@file:JvmName("Utils")
fun useXBar(x: X) = x.bar()