[atomicfu-K/N] Tests for K/N atomicfu-compiler-plugin
* `nativeTest` task now allows to provide compiler plugins that may be enabled during test compilation * test sets for JVM and K/N backends are equal KT-60800 describes all the issues with native tests that were solved in this commit. Co-authored-by: Dmitriy Dolovov <Dmitriy.Dolovov@jetbrains.com> Merge-request: KT-MR-11401 Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
|
||||
class MultiInitTest {
|
||||
fun testBasic() {
|
||||
val t = MultiInit()
|
||||
check(t.incA() == 1)
|
||||
check(t.incA() == 2)
|
||||
check(t.incB() == 1)
|
||||
check(t.incB() == 2)
|
||||
}
|
||||
}
|
||||
|
||||
class MultiInit {
|
||||
private val a = atomic(0)
|
||||
private val b = atomic(0)
|
||||
|
||||
fun incA() = a.incrementAndGet()
|
||||
fun incB() = b.incrementAndGet()
|
||||
|
||||
companion object {
|
||||
fun foo() {} // just to force some clinit in outer file
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun box() {
|
||||
val testClass = MultiInitTest()
|
||||
testClass.testBasic()
|
||||
}
|
||||
Reference in New Issue
Block a user