Add IC scope expansion tests
#KT-13677 #KT-28233
This commit is contained in:
+49
@@ -891,4 +891,53 @@ public class IncrementalJsKlibCompilerWithScopeExpansionRunnerTestGenerated exte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jps-plugin/testData/incremental/scopeExpansion")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class ScopeExpansion extends AbstractIncrementalJsKlibCompilerWithScopeExpansionRunnerTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInScopeExpansion() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/scopeExpansion"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("changeTypeAliasAndUsage")
|
||||||
|
public void testChangeTypeAliasAndUsage() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/scopeExpansion/changeTypeAliasAndUsage/");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("protectedBecomesPublicAccessedTroughChild")
|
||||||
|
public void testProtectedBecomesPublicAccessedTroughChild() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/scopeExpansion/protectedBecomesPublicAccessedTroughChild/");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jps-plugin/testData/incremental/scopeExpansion/changeTypeAliasAndUsage")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class ChangeTypeAliasAndUsage extends AbstractIncrementalJsKlibCompilerWithScopeExpansionRunnerTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInChangeTypeAliasAndUsage() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/scopeExpansion/changeTypeAliasAndUsage"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("jps-plugin/testData/incremental/scopeExpansion/protectedBecomesPublicAccessedTroughChild")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class ProtectedBecomesPublicAccessedTroughChild extends AbstractIncrementalJsKlibCompilerWithScopeExpansionRunnerTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInProtectedBecomesPublicAccessedTroughChild() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/scopeExpansion/protectedBecomesPublicAccessedTroughChild"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1234,6 +1234,7 @@ fun main(args: Array<String>) {
|
|||||||
model("incremental/pureKotlin", extension = null, recursive = false)
|
model("incremental/pureKotlin", extension = null, recursive = false)
|
||||||
model("incremental/classHierarchyAffected", extension = null, recursive = false)
|
model("incremental/classHierarchyAffected", extension = null, recursive = false)
|
||||||
model("incremental/js", extension = null, excludeParentDirs = true)
|
model("incremental/js", extension = null, excludeParentDirs = true)
|
||||||
|
model("incremental/scopeExpansion", extension = null, excludeParentDirs = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
testClass<AbstractIncrementalJsCompilerRunnerWithFriendModulesDisabledTest> {
|
testClass<AbstractIncrementalJsCompilerRunnerWithFriendModulesDisabledTest> {
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface Foo {
|
||||||
|
val value: TypeAlias
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
class FooImpl : Foo {
|
||||||
|
override val value: TypeAlias
|
||||||
|
get() = "0"
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
class FooImpl : Foo {
|
||||||
|
override val value: TypeAlias
|
||||||
|
get() = 1
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
typealias TypeAlias = String
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
typealias TypeAlias = Int
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
================ Step #1 =================
|
||||||
|
|
||||||
|
Compiling files:
|
||||||
|
src/Foo.kt
|
||||||
|
src/FooImpl.kt
|
||||||
|
src/TypeAlias.kt
|
||||||
|
End of files
|
||||||
|
Exit code: OK
|
||||||
|
------------------------------------------
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun dummy() {}
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
protected open fun foo(): Int = 0
|
||||||
|
}
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
open fun foo(): Int = 0
|
||||||
|
}
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
open class B : A() {
|
||||||
|
override fun foo(): Int = 1
|
||||||
|
}
|
||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
================ Step #1 =================
|
||||||
|
|
||||||
|
Compiling files:
|
||||||
|
src/a.kt
|
||||||
|
src/b.kt
|
||||||
|
src/usage.kt
|
||||||
|
End of files
|
||||||
|
Exit code: OK
|
||||||
|
------------------------------------------
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package other
|
||||||
|
|
||||||
|
fun other() = "other"
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
B().foo()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user