Add script codegen tests with package statements
Tests codegen annotating visitor
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
package script.long.name.inside.packag
|
||||||
|
|
||||||
|
interface I {
|
||||||
|
fun g(): I
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f(): I {
|
||||||
|
return object : I {
|
||||||
|
override fun g() = object : I {
|
||||||
|
override fun g(): I = this
|
||||||
|
|
||||||
|
override fun toString() = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val rv = f().g().g().g()
|
||||||
|
|
||||||
|
// expected: rv: OK
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package script
|
||||||
|
|
||||||
|
fun f(j: Int): Int {
|
||||||
|
fun g(i: Int) = i * i *j
|
||||||
|
|
||||||
|
return g(g(j))
|
||||||
|
}
|
||||||
|
|
||||||
|
val rv = f(2)
|
||||||
|
|
||||||
|
// expected: rv: 128
|
||||||
@@ -41,6 +41,12 @@ public class ScriptCodegenTestGenerated extends AbstractScriptCodegenTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/script"), Pattern.compile("^(.+)\\.kts$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/script"), Pattern.compile("^(.+)\\.kts$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classLiteralInsideFunction.kts")
|
||||||
|
public void testClassLiteralInsideFunction() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/classLiteralInsideFunction.kts");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("empty.kts")
|
@TestMetadata("empty.kts")
|
||||||
public void testEmpty() throws Exception {
|
public void testEmpty() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/empty.kts");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/empty.kts");
|
||||||
@@ -59,6 +65,12 @@ public class ScriptCodegenTestGenerated extends AbstractScriptCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("localFunction.kts")
|
||||||
|
public void testLocalFunction() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/localFunction.kts");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("outerCapture.kts")
|
@TestMetadata("outerCapture.kts")
|
||||||
public void testOuterCapture() throws Exception {
|
public void testOuterCapture() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/outerCapture.kts");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/outerCapture.kts");
|
||||||
|
|||||||
Reference in New Issue
Block a user