Merge boxWithStdlib testData into box, delete BoxWithStdlib test

This commit is contained in:
Alexander Udalov
2016-03-07 13:36:14 +03:00
committed by Alexander Udalov
parent 22bfc9786a
commit 06a67e6602
535 changed files with 3520 additions and 3871 deletions
@@ -0,0 +1,38 @@
// WITH_RUNTIME
fun fn0() {}
fun fn1(x: Any) {}
inline fun <reified T> assertReifiedIs(x: Any, type: String) {
val answer: Boolean
try {
answer = x is T
}
catch (e: Throwable) {
throw AssertionError("$x is $type: should not throw exceptions, got $e")
}
assert(answer) { "$x is $type: failed" }
}
inline fun <reified T> assertReifiedIsNot(x: Any, type: String) {
val answer: Boolean
try {
answer = x !is T
}
catch (e: Throwable) {
throw AssertionError("$x !is $type: should not throw exceptions, got $e")
}
assert(answer) { "$x !is $type: failed" }
}
fun box(): String {
val f0 = ::fn0 as Any
val f1 = ::fn1 as Any
assertReifiedIs<Function0<*>>(f0, "Function0<*>")
assertReifiedIs<Function1<*, *>>(f1, "Function1<*, *>")
assertReifiedIsNot<Function0<*>>(f1, "Function0<*>")
assertReifiedIsNot<Function1<*, *>>(f0, "Function1<*, *>")
return "OK"
}