Files
kotlin-fork/plugins/atomicfu/atomicfu-compiler/testData/nativeBox/atomic_extensions/ParameterizedInlineFunExtensionTest.kt
T

32 lines
826 B
Kotlin
Vendored

// TODO(KT-65977): reenable these tests with caches
//IGNORE_NATIVE: cacheMode=STATIC_EVERYWHERE
//IGNORE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE
import kotlinx.atomicfu.*
import kotlin.test.*
class ParameterizedInlineFunExtensionTest {
private inline fun <S> AtomicRef<S>.foo(res1: S, res2: S, foo: (S) -> S): S {
val res = bar(res1, res2)
return res
}
private inline fun <S> AtomicRef<S>.bar(res1: S, res2: S): S {
return res2
}
private val tail = atomic("aaa")
fun testClose() {
assertEquals("bbb", tail.bar("aaa", "bbb"))
val res = tail.foo("bbb", "ccc") { s -> s }
assertEquals("ccc", res)
}
}
@Test
fun testParameterizedInlineFunExtensionTest() {
val testClass = ParameterizedInlineFunExtensionTest()
testClass.testClose()
}