[K/N] Test for freezing disabling

This commit is contained in:
Pavel Kunyavskiy
2022-01-25 10:38:52 +03:00
committed by Space
parent 68117faa73
commit 803014ef24
2 changed files with 38 additions and 0 deletions
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package runtime.workers.freeze_disabled
import kotlin.test.*
import kotlin.native.concurrent.*
// this test is ran with disabled freezing, so no mutability checks are done
class A(var x:Int)
@Test
fun testClassNotFrozen(){
val a = A(1)
a.freeze()
a.x = 2
assertEquals(a.x, 2)
}
@Test
fun testArrayNotFrozen(){
val a = arrayOf(1, 2, 3, 4, 5)
a.freeze()
a[0] = 6
assertEquals(a[0], 6)
}