JS: create new common directory for all generated tests, migrate several tests there

This commit is contained in:
Alexey Andreev
2016-08-26 16:44:48 +03:00
parent 34a57f863b
commit 2bf0199959
321 changed files with 2123 additions and 2001 deletions
@@ -0,0 +1,43 @@
package foo
import kotlin.reflect.KProperty
interface Getter<T> {
fun get(): T
}
class Delegate<T>(val getter: Getter<T>) {
var t: T? = null
operator fun getValue(obj: Any, property: KProperty<*>): T {
if (t != null) {
return t!!
}
return getter.get()
}
operator fun setValue(obj: Any, property: KProperty<*>, value: T) {
t = value
}
}
class A : Getter<Int> {
var value = 0
override fun get(): Int {
return value
}
val delegate = Delegate(this)
val a by delegate
var b by delegate
}
fun box(): String {
val a = A()
if (a.a != 0) return "a.a != 0"
if (a.b != 0) return "a.b != 0"
a.b = 4
if (a.a != 4) return "a.a != 4"
if (a.b != 4) return "a.b != 4"
return "OK"
}