Update box tests to 1.2.0-rc-39

This commit is contained in:
Pavel Punegov
2017-11-09 20:27:53 +03:00
committed by Pavel Punegov
parent 0121b6a185
commit ffa1ffa659
442 changed files with 20811 additions and 165 deletions
@@ -0,0 +1,19 @@
var result = ""
class A {
companion object {
val prop = test()
fun test(): String {
result += "OK"
return result
}
}
}
fun box(): String {
if (A.prop != "OK") return "fail ${A.prop}"
return result
}
@@ -0,0 +1,19 @@
var result = ""
interface A {
companion object {
val prop = test()
fun test(): String {
result += "OK"
return result
}
}
}
fun box(): String {
if (A.prop != "OK") return "fail ${A.prop}"
return result
}
@@ -0,0 +1,37 @@
// WITH_RUNTIME
import kotlin.test.*
interface Test {
companion object {
val x = "OK"
val y1 = Test.x
val y2 = 42.let { x }
val y3: String
init {
fun localFun() = x
y3 = localFun()
}
fun method() = x
val y4 = method()
val anonObject = object {
override fun toString() = x
}
val y5 = anonObject.toString()
init {
assertEquals(x, y1)
assertEquals(x, y2)
assertEquals(x, y3)
assertEquals(x, y4)
assertEquals(x, y5)
}
}
}
fun box() = Test.x
@@ -0,0 +1,9 @@
import Foo.bar0 as bar
object Foo {
val bar0 = "OK"
fun test() = bar0
}
fun box() = Foo.test()
@@ -0,0 +1,15 @@
var result = ""
object A {
val prop = test()
fun test(): String {
result += "OK"
return result
}
}
fun box(): String {
if (A.prop != "OK") return "fail ${A.prop}"
return result
}
@@ -0,0 +1,17 @@
interface IFn {
operator fun invoke(): String
}
abstract class Base(val fn: IFn)
class Host {
companion object : Base(
object : IFn {
override fun invoke(): String = Host.ok()
}
) {
fun ok() = "OK"
}
}
fun box() = Host.Companion.fn()
@@ -0,0 +1,9 @@
class Test {
companion object {
fun ok() = "OK"
val x = run { Test.ok() }
fun test() = x
}
}
fun box() = Test.test()
@@ -0,0 +1,9 @@
abstract class Base(val fn: () -> String)
class Host {
companion object : Base(run { { Host.ok() } }) {
fun ok() = "OK"
}
}
fun box() = Host.Companion.fn()
@@ -0,0 +1,9 @@
abstract class Base(val fn: () -> String)
class Host {
companion object : Base({ Host.ok() }) {
fun ok() = "OK"
}
}
fun box() = Host.Companion.fn()
@@ -0,0 +1,17 @@
interface IFn {
operator fun invoke(): String
}
abstract class Base(val fn: IFn)
interface Host {
companion object : Base(
object : IFn {
override fun invoke(): String = Host.ok()
}
) {
fun ok() = "OK"
}
}
fun box() = Host.Companion.fn()
@@ -0,0 +1,9 @@
interface Test {
companion object {
fun ok() = "OK"
val x = run { Test.ok() }
fun test() = x
}
}
fun box() = Test.test()
@@ -0,0 +1,9 @@
abstract class Base(val fn: () -> String)
interface Host {
companion object : Base(run { { Host.ok() } }) {
fun ok() = "OK"
}
}
fun box() = Host.Companion.fn()
@@ -0,0 +1,9 @@
abstract class Base(val fn: () -> String)
interface Host {
companion object : Base({ Host.ok() }) {
fun ok() = "OK"
}
}
fun box() = Host.Companion.fn()
@@ -0,0 +1,15 @@
interface IFn {
operator fun invoke(): String
}
abstract class Base(val fn: IFn)
object Test : Base(
object : IFn {
override fun invoke(): String = Test.ok()
}
) {
fun ok() = "OK"
}
fun box() = Test.fn()
@@ -0,0 +1,7 @@
object Test {
fun ok() = "OK"
val x = run { Test.ok() }
fun test() = x
}
fun box() = Test.test()
@@ -0,0 +1,7 @@
abstract class Base(val fn: () -> String)
object Test : Base(run { { Test.ok() } }) {
fun ok() = "OK"
}
fun box() = Test.fn()
@@ -0,0 +1,7 @@
abstract class Base(val fn: () -> String)
object Test : Base({ Test.ok() }) {
fun ok() = "OK"
}
fun box() = Test.fn()