[K/N][Tests] Migrate objcSmoke & objcTests tests
^KT-61259
This commit is contained in:
committed by
Space Team
parent
58f7dd1c83
commit
524f0d335e
@@ -0,0 +1,23 @@
|
||||
@file:OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
import kotlin.test.*
|
||||
import objcTests.*
|
||||
|
||||
@Test fun testCustomString() {
|
||||
assertFalse(customStringDeallocated)
|
||||
|
||||
fun test() = autoreleasepool {
|
||||
val str: String = createCustomString(321)
|
||||
assertEquals("321", str)
|
||||
assertEquals("CustomString", str.objCClassName)
|
||||
assertEquals(321, getCustomStringValue(str))
|
||||
}
|
||||
|
||||
test()
|
||||
kotlin.native.runtime.GC.collect()
|
||||
assertTrue(customStringDeallocated)
|
||||
}
|
||||
|
||||
private val Any.objCClassName: String
|
||||
get() = object_getClassName(this)!!.toKString()
|
||||
Reference in New Issue
Block a user