kotlinx.atomicfu compiler plugin for JS_IR backend (#4581)
* kotlinx.atomicfu compiler plugin for JS_IR Support transformations of atomic operations introduced by the kotlinx.atomicfu library for the JS_IR backend. Compiler plugin is applied externally by the kotlinx.atomicfu gradle plugin. * Apply compiler plugin for JS platform only * New plugin test structure * testGroupOutputDirPrefix changed
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import kotlinx.atomicfu.*
|
||||
import kotlinx.atomicfu.locks.*
|
||||
import kotlin.test.*
|
||||
|
||||
class PropertyDeclarationTest {
|
||||
private val a: AtomicInt
|
||||
private val head: AtomicRef<String>
|
||||
private val lateIntArr: AtomicIntArray
|
||||
private val lateRefArr: AtomicArray<String?>
|
||||
private val lock: ReentrantLock
|
||||
|
||||
init {
|
||||
a = atomic(0)
|
||||
head = atomic("AAA")
|
||||
lateIntArr = AtomicIntArray(55)
|
||||
lateRefArr = atomicArrayOfNulls<String?>(10)
|
||||
lock = reentrantLock()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
assertEquals(0, a.value)
|
||||
check(head.compareAndSet("AAA", "BBB"))
|
||||
assertEquals("BBB", head.value)
|
||||
assertEquals(0, lateIntArr[35].value)
|
||||
assertEquals(null, lateRefArr[5].value)
|
||||
assertEquals(null, lock)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = PropertyDeclarationTest()
|
||||
testClass.test()
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user