Refactor: extract JVM-specific tests into separate files

Make KotlinVersion random comparison test running in JS
This commit is contained in:
Ilya Gorbunov
2018-03-21 18:52:00 +03:00
parent 2d099a29b8
commit 7a40b4c5f1
12 changed files with 260 additions and 204 deletions
@@ -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) {