Refactor: extract JVM-specific tests into separate files
Make KotlinVersion random comparison test running in JS
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package test.properties.delegation.lazy
|
||||
|
||||
import kotlin.properties.*
|
||||
import kotlin.test.*
|
||||
|
||||
class LazyValTest {
|
||||
@@ -15,24 +14,6 @@ class LazyValTest {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmVersion
|
||||
class SynchronizedLazyValTest {
|
||||
@Volatile var result = 0
|
||||
val a by lazy(this) {
|
||||
++result
|
||||
}
|
||||
|
||||
@Test fun doTest() {
|
||||
synchronized(this) {
|
||||
kotlin.concurrent.thread { a } // not available in js
|
||||
result = 1
|
||||
a
|
||||
}
|
||||
assertTrue(a == 2, "fail: initializer should be invoked only once")
|
||||
assertTrue(result == 2, "fail result should be incremented after test")
|
||||
}
|
||||
}
|
||||
|
||||
class UnsafeLazyValTest {
|
||||
var result = 0
|
||||
val a by lazy(LazyThreadSafetyMode.NONE) {
|
||||
|
||||
Reference in New Issue
Block a user