Added some new test for java8
This commit is contained in:
+21
-3
@@ -35,9 +35,15 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/boxWithJava"), Pattern.compile("^([^\\.]+)$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultMethodCall")
|
||||
public void testDefaultMethodCall() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCall/");
|
||||
@TestMetadata("defaultMethodCallFromTrait")
|
||||
public void testDefaultMethodCallFromTrait() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultMethodCallViaClass")
|
||||
public void testDefaultMethodCallViaClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@@ -47,12 +53,24 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultMethodOverride")
|
||||
public void testDefaultMethodOverride() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("dontDelegateToDefaultMethods")
|
||||
public void testDontDelegateToDefaultMethods() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inheritKotlin")
|
||||
public void testInheritKotlin() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/inheritKotlin/");
|
||||
doTestWithJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("samOnInterfaceWithDefaultMethod")
|
||||
public void testSamOnInterfaceWithDefaultMethod() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/");
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
trait KTrait : Simple {
|
||||
fun bar(): String {
|
||||
return test("O") + Simple.testStatic("O")
|
||||
}
|
||||
}
|
||||
|
||||
class Test : KTrait {}
|
||||
|
||||
fun box(): String {
|
||||
val test = Test().bar()
|
||||
if (test != "OKOK") return "fail $test"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
interface Simple {
|
||||
default String test(String s) {
|
||||
return s + "K";
|
||||
}
|
||||
|
||||
static String testStatic(String s) {
|
||||
return s + "K";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
interface Simple {
|
||||
default String test(String s) {
|
||||
return s + "Fail";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
trait KTrait: Simple {
|
||||
override fun test(s: String): String {
|
||||
return s + "K"
|
||||
}
|
||||
}
|
||||
|
||||
class Test : KTrait {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Test().test("O")
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
interface Simple extends KTrait {
|
||||
default String test() {
|
||||
return "simple";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
trait KTrait {
|
||||
fun test(): String {
|
||||
return "base";
|
||||
}
|
||||
}
|
||||
|
||||
class Test : Simple {
|
||||
|
||||
fun bar(): String {
|
||||
return super.test()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val test = Test().test()
|
||||
if (test != "simple") return "fail $test"
|
||||
|
||||
val bar = Test().bar()
|
||||
if (bar != "simple") return "fail 2 $bar"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user