[K/N][tests] Migrate various runtime/ tests ^KT-61259
This commit is contained in:
committed by
Space Team
parent
7ad4e58a7a
commit
d88092aa94
+19
@@ -0,0 +1,19 @@
|
||||
// DISABLE_NATIVE: gcType=NOOP
|
||||
|
||||
import kotlin.test.*
|
||||
import kotlin.native.ref.*
|
||||
|
||||
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class, kotlin.experimental.ExperimentalNativeApi::class)
|
||||
@Test fun runTest() {
|
||||
val weakRefToTrashCycle = createLoop()
|
||||
kotlin.native.runtime.GC.collect()
|
||||
assertNull(weakRefToTrashCycle.get())
|
||||
}
|
||||
|
||||
@OptIn(kotlin.experimental.ExperimentalNativeApi::class)
|
||||
private fun createLoop(): WeakReference<Any> {
|
||||
val loop = Array<Any?>(1, { null })
|
||||
loop[0] = loop
|
||||
|
||||
return WeakReference(loop)
|
||||
}
|
||||
Reference in New Issue
Block a user