K2: Add new tests for PCLA implementation
Many of them have been found & minimized at FP tests/user projects ^KT-59791 Fixed
This commit is contained in:
committed by
Space Team
parent
90feeab076
commit
7e4d9d9f64
+30
@@ -0,0 +1,30 @@
|
||||
class Buildee<CT> {
|
||||
var r: CT? = null
|
||||
fun yield(arg: CT) {
|
||||
r = arg
|
||||
}
|
||||
}
|
||||
|
||||
fun <FT> build(instructions: Buildee<FT>.() -> Unit): Buildee<FT> {
|
||||
return Buildee<FT>().apply(instructions)
|
||||
}
|
||||
|
||||
|
||||
class Logger {
|
||||
fun error() {
|
||||
throw RuntimeException("")
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> logger(arg: T): Logger = Logger()
|
||||
|
||||
fun box(): String {
|
||||
val b = build {
|
||||
if ("".hashCode() == 0) {
|
||||
yield("OK")
|
||||
} else {
|
||||
logger(this).error()
|
||||
}
|
||||
}
|
||||
return b.r ?: "fail"
|
||||
}
|
||||
Reference in New Issue
Block a user