more small tests

This commit is contained in:
Svetlana Isakova
2012-05-04 20:43:41 +04:00
parent 821127ac7e
commit 22e9e7de10
5 changed files with 51 additions and 38 deletions
@@ -0,0 +1,7 @@
//KT-1061 Can't call function defined as a val
object X {
val doit = { (i: Int) -> i }
}
fun box() : String = if (X.doit(3) == 3) "OK" else "fail"
@@ -0,0 +1,12 @@
//KT-1249 IllegalStateException invoking function property
class TestClass(val body : () -> Unit) : Any {
fun run() {
body()
}
}
fun box() : String {
TestClass({}).run()
return "OK"
}
@@ -0,0 +1,14 @@
//KT-1290 Method property in constructor causes NPE
class Foo<T>(val filter: (T) -> Boolean) {
public fun bar(tee: T) : Boolean {
return filter(tee);
}
}
fun foo() = Foo({ (i: Int) -> i < 5 }).bar(2)
fun box() : String {
if (!foo()) return "fail"
return "OK"
}
+2 -38
View File
@@ -23,43 +23,7 @@ trait ChannelPipelineFactory {
fun getPipeline() : ChannelPipeline
}
fun testKt606() {
StandardPipelineFactory({ print("OK") }).getPipeline()
}
//Tests for duplicates
//KT-1061 Can't call function defined as a val
object X {
val doit = { (i: Int) -> i }
}
fun testKt1061() : String = if (X.doit(3) == 3) "OK" else "fail"
//KT-1249 IllegalStateException invoking function property
class TestClass(val body : () -> Unit) : Any {
fun run() {
body()
}
}
fun testKt1249() {
TestClass({}).run()
}
class Foo<T>(val filter: (T) -> Boolean) {
public fun bar(tee: T) : Boolean {
return filter(tee);
}
}
//KT-1290 Method property in constructor causes NPE
fun testKt1290() = Foo({ (i: Int) -> i < 5 }).bar(2)
fun box() : String {
testKt606()
testKt1061()
testKt1249()
if (!testKt1290()) return "fail"
StandardPipelineFactory({ print("OK") }).getPipeline()
return "OK"
}
}