Merge boxWithStdlib testData into box, delete BoxWithStdlib test
This commit is contained in:
committed by
Alexander Udalov
parent
22bfc9786a
commit
06a67e6602
@@ -0,0 +1,19 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
inline fun<reified T> safecast(x: Any?): T? {
|
||||
return x as? T
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val x = safecast<String>("abc")
|
||||
assertEquals("abc", x)
|
||||
val y = safecast<Int>(1)
|
||||
assertEquals(1, y)
|
||||
|
||||
val z = safecast<Int>("abc")
|
||||
assertEquals(null, z)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user