Add script codegen tests with package statements

Tests codegen annotating visitor
This commit is contained in:
Pavel V. Talanov
2015-11-18 13:26:12 +03:00
parent ae5c95038b
commit bdc64f322c
3 changed files with 42 additions and 0 deletions
@@ -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
+11
View File
@@ -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);
}
@TestMetadata("classLiteralInsideFunction.kts")
public void testClassLiteralInsideFunction() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/classLiteralInsideFunction.kts");
doTest(fileName);
}
@TestMetadata("empty.kts")
public void testEmpty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/empty.kts");
@@ -59,6 +65,12 @@ public class ScriptCodegenTestGenerated extends AbstractScriptCodegenTest {
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")
public void testOuterCapture() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/outerCapture.kts");