Added tests with SAM adapter overridden in Kotlin class.

This commit is contained in:
Evgeny Gerashchenko
2013-06-20 20:59:40 +04:00
parent f4c3a89408
commit fd7b29ad48
7 changed files with 62 additions and 0 deletions
@@ -0,0 +1,7 @@
class Super {
public String lastCalled = null;
void foo(Runnable r) {
lastCalled = "super";
}
}
@@ -0,0 +1,21 @@
class Sub() : Super() {
override fun foo(r : (() -> Unit)?) {
lastCalled = "sub"
}
}
fun box(): String {
val sub = Sub()
(sub : Super).foo{ }
if (sub.lastCalled != "super") {
return "FAIL: ${sub.lastCalled} instead of super"
}
sub.foo{ }
if (sub.lastCalled != "sub") {
return "FAIL: ${sub.lastCalled} instead of sub"
}
return "OK"
}