Add test based on #2931
This commit is contained in:
committed by
SvyatoslavScherbina
parent
78715b14c5
commit
d483990c7e
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package conversions
|
package conversions
|
||||||
|
|
||||||
|
import kotlin.native.concurrent.freeze
|
||||||
import kotlin.native.concurrent.isFrozen
|
import kotlin.native.concurrent.isFrozen
|
||||||
import kotlin.properties.ReadWriteProperty
|
import kotlin.properties.ReadWriteProperty
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
@@ -337,4 +338,16 @@ fun createTransformDecimalStringToInt(): Transform<String, Int> = TransformDecim
|
|||||||
|
|
||||||
open class TransformIntToLong : Transform<Int, Long> {
|
open class TransformIntToLong : Transform<Int, Long> {
|
||||||
override fun map(value: Int): Long = value.toLong()
|
override fun map(value: Int): Long = value.toLong()
|
||||||
|
}
|
||||||
|
|
||||||
|
class GH2931 {
|
||||||
|
class Data
|
||||||
|
|
||||||
|
class Holder {
|
||||||
|
val data = Data()
|
||||||
|
|
||||||
|
init {
|
||||||
|
freeze()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -526,6 +526,27 @@ func testKotlinOverride() throws {
|
|||||||
try assertEquals(actual: TransformIntToLongCallingSuper().map(value: 5), expected: 5)
|
try assertEquals(actual: TransformIntToLongCallingSuper().map(value: 5), expected: 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See https://github.com/JetBrains/kotlin-native/issues/2931
|
||||||
|
func testGH2931() throws {
|
||||||
|
for i in 0..<50000 {
|
||||||
|
let holder = GH2931.Holder()
|
||||||
|
let queue = DispatchQueue.global(qos: .background)
|
||||||
|
let group = DispatchGroup()
|
||||||
|
|
||||||
|
for j in 0..<2 {
|
||||||
|
group.enter()
|
||||||
|
queue.async {
|
||||||
|
autoreleasepool {
|
||||||
|
holder.data
|
||||||
|
}
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group.wait()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------- Execution of the test --------
|
// -------- Execution of the test --------
|
||||||
|
|
||||||
class ValuesTests : TestProvider {
|
class ValuesTests : TestProvider {
|
||||||
@@ -565,6 +586,7 @@ class ValuesTests : TestProvider {
|
|||||||
TestCase(name: "TestNames", method: withAutorelease(testNames)),
|
TestCase(name: "TestNames", method: withAutorelease(testNames)),
|
||||||
TestCase(name: "TestSwiftOverride", method: withAutorelease(testSwiftOverride)),
|
TestCase(name: "TestSwiftOverride", method: withAutorelease(testSwiftOverride)),
|
||||||
TestCase(name: "TestKotlinOverride", method: withAutorelease(testKotlinOverride)),
|
TestCase(name: "TestKotlinOverride", method: withAutorelease(testKotlinOverride)),
|
||||||
|
TestCase(name: "TestGH2931", method: withAutorelease(testGH2931)),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user