[K/N][tests] Adjust moved tests to new testing infra

^KT-61259
This commit is contained in:
Vladimir Sukharev
2024-01-03 22:37:53 +01:00
committed by Space Team
parent 0a0da76a56
commit e68bd1f04f
23 changed files with 183 additions and 123 deletions
@@ -3,51 +3,66 @@
* that can be found in the LICENSE file.
*/
package runtime.basic.initializers0
import kotlin.test.*
val sb = StringBuilder()
class A {
init{
println ("A::init")
sb.appendLine ("A::init")
}
val a = 1
companion object :B(1) {
init {
println ("A::companion")
sb.appendLine ("A::companion")
}
fun foo() {
println("A::companion::foo")
sb.appendLine("A::companion::foo")
}
}
object AObj : B(){
init {
println("A::Obj")
sb.appendLine("A::Obj")
}
fun foo() {
println("A::AObj::foo")
sb.appendLine("A::AObj::foo")
}
}
}
@Test fun runTest() {
println("main")
fun box(): String {
sb.appendLine("main")
A.foo()
A.foo()
A.AObj.foo()
A.AObj.foo()
assertEquals("""
main
B::constructor(1)
A::companion
A::companion::foo
A::companion::foo
B::constructor(0)
B::constructor()
A::Obj
A::AObj::foo
A::AObj::foo
""".trimIndent(), sb.toString())
return "OK"
}
open class B(val a:Int, val b:Int) {
constructor(a:Int):this (a, 0) {
println("B::constructor(" + a.toString()+ ")")
sb.appendLine("B::constructor(" + a.toString()+ ")")
}
constructor():this(0) {
println("B::constructor()")
sb.appendLine("B::constructor()")
}
}
@@ -2,21 +2,21 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.initializers1
import kotlin.test.*
val sb = StringBuilder()
class TestClass {
companion object {
init {
println("Init Test")
sb.append("OK")
}
}
}
@Test fun runTest() {
fun box(): String {
val t1 = TestClass()
val t2 = TestClass()
println("Done")
return sb.toString()
}
@@ -3,9 +3,13 @@
* that can be found in the LICENSE file.
*/
import kotlin.test.*
val sb = StringBuilder()
class A(val msg: String) {
init {
println("init $msg")
sb.appendLine("init $msg")
}
override fun toString(): String = msg
}
@@ -14,9 +18,19 @@ val globalValue1 = 1
val globalValue2 = A("globalValue2")
val globalValue3 = A("globalValue3")
fun main(args: Array<String>) {
println(globalValue1.toString())
println(globalValue2.toString())
println(globalValue3.toString())
fun box(): String {
sb.appendLine(globalValue1.toString())
sb.appendLine(globalValue2.toString())
sb.appendLine(globalValue3.toString())
assertEquals("""
init globalValue2
init globalValue3
1
globalValue2
globalValue3
""".trimIndent(), sb.toString())
return "OK"
}
@@ -2,15 +2,13 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.initializers3
import kotlin.test.*
class Foo(val bar: Int)
var x = Foo(42)
@Test fun runTest() {
println(x.bar)
fun box(): String {
assertEquals(42, x.bar)
return "OK"
}
@@ -2,15 +2,14 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.initializers4
import kotlin.test.*
const val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1
val DOUBLE = Double.MAX_VALUE - 1.0
@Test fun runTest() {
println(INT_MAX_POWER_OF_TWO)
println(DOUBLE > 0.0)
fun box(): String {
assertEquals(1073741824, INT_MAX_POWER_OF_TWO)
assertTrue(DOUBLE > 0.0)
return "OK"
}
@@ -2,9 +2,6 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.initializers5
import kotlin.test.*
object A {
@@ -12,6 +9,8 @@ object A {
val b = A.a
}
@Test fun runTest() {
println(A.b)
fun box(): String {
assertEquals(42, A.b)
return "OK"
}
@@ -2,9 +2,6 @@
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.initializers7
import kotlin.test.*
object A {
@@ -53,8 +50,10 @@ fun assertCUninitialized() {
assertEquals(0, C.c4)
}
@Test fun runTest() {
fun box(): String {
assertEquals(A.a1, C.c2)
assertEquals(A.a2, C.c3)
assertEquals(C.c1, C.c4)
return "OK"
}
@@ -2,13 +2,10 @@
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.initializers8
import kotlin.test.*
var globalString = "abc"
var globalString = "OK"
@Test fun runTest() {
assertEquals("abc", globalString)
fun box(): String {
return globalString
}