BC native tests port to Konan's TestRunner

This commit is contained in:
Pavel Punegov
2017-10-11 15:09:33 +03:00
parent 9b07fd61ce
commit 9d077d7f4f
352 changed files with 1798 additions and 384 deletions
@@ -1,15 +1,20 @@
fun main(args: Array<String>) {
package codegen.basics.cast_null
import kotlin.test.*
@Test
fun runTest() {
testCast(null, false)
testCastToNullable(null, true)
testCastToNullable(Test(), true)
testCastToNullable(TestKlass(), true)
testCastToNullable("", false)
testCastNotNullableToNullable(Test(), true)
testCastNotNullableToNullable(TestKlass(), true)
testCastNotNullableToNullable("", false)
println("Ok")
}
class Test
class TestKlass
fun ensure(b: Boolean) {
if (!b) {
@@ -19,7 +24,7 @@ fun ensure(b: Boolean) {
fun testCast(x: Any?, expectSuccess: Boolean) {
try {
x as Test
x as TestKlass
} catch (e: Throwable) {
ensure(!expectSuccess)
return
@@ -29,7 +34,7 @@ fun testCast(x: Any?, expectSuccess: Boolean) {
fun testCastToNullable(x: Any?, expectSuccess: Boolean) {
try {
x as Test?
x as TestKlass?
} catch (e: Throwable) {
ensure(!expectSuccess)
return
@@ -39,7 +44,7 @@ fun testCastToNullable(x: Any?, expectSuccess: Boolean) {
fun testCastNotNullableToNullable(x: Any, expectSuccess: Boolean) {
try {
x as Test?
x as TestKlass?
} catch (e: Throwable) {
ensure(!expectSuccess)
return