Added some new test for java8

This commit is contained in:
Michael Bogdanov
2015-05-12 17:38:08 +03:00
parent 37dfa58cd3
commit 3fbdf05921
10 changed files with 90 additions and 3 deletions

View File

@@ -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"
}

View File

@@ -0,0 +1,9 @@
interface Simple {
default String test(String s) {
return s + "K";
}
static String testStatic(String s) {
return s + "K";
}
}

View File

@@ -0,0 +1,5 @@
interface Simple {
default String test(String s) {
return s + "Fail";
}
}

View File

@@ -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")
}

View File

@@ -0,0 +1,5 @@
interface Simple extends KTrait {
default String test() {
return "simple";
}
}

View File

@@ -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"
}