c7435ba760
We are going to deprecate `WITH_RUNTIME` directive. The main reason behind this change is that `WITH_STDLIB` directive better describes its meaning, specifically it will add kotlin stdlib to test's classpath.
27 lines
590 B
Kotlin
Vendored
27 lines
590 B
Kotlin
Vendored
// WITH_STDLIB
|
|
|
|
var order = StringBuilder()
|
|
|
|
inline fun expectOrder(at: String, expected: String, body: () -> Unit) {
|
|
order = StringBuilder() // have to do that in order to run this test in JS
|
|
body()
|
|
if (order.toString() != expected) throw AssertionError("$at: expected: $expected, actual: $order")
|
|
}
|
|
|
|
fun list(): List<Int> {
|
|
order.append("L")
|
|
return emptyList()
|
|
}
|
|
|
|
|
|
fun x(i: Int): Int {
|
|
order.append("X")
|
|
return i
|
|
}
|
|
|
|
fun box(): String {
|
|
expectOrder("1 in []", "LX") { x(1) in list() }
|
|
expectOrder("1 !in []", "LX") { x(1) !in list() }
|
|
|
|
return "OK"
|
|
} |