Remove duplicate tests from JS compiler test set. Merge chages to common compiler tests
This commit is contained in:
-13
@@ -1,13 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1293
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
abstract class Base {
|
||||
val result = "OK"
|
||||
}
|
||||
|
||||
class Derived : Base()
|
||||
|
||||
fun box(): String {
|
||||
return (Base::result).get(Derived())
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1240
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
object NumberDecrypter {
|
||||
operator fun getValue(instance: Any?, data: KProperty<*>) = when (data.name) {
|
||||
"four" -> 4
|
||||
"two" -> 2
|
||||
else -> throw Exception()
|
||||
}
|
||||
}
|
||||
|
||||
val four: Int by NumberDecrypter
|
||||
|
||||
class A {
|
||||
val two: Int by NumberDecrypter
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val x = ::four.get()
|
||||
if (x != 4) return "Fail x: $x"
|
||||
val a = A()
|
||||
val y = A::two.get(a)
|
||||
if (y != 2) return "Fail y: $y"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1298
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
object Delegate {
|
||||
var value = "lol"
|
||||
|
||||
operator fun getValue(instance: Any?, data: KProperty<*>): String {
|
||||
return value
|
||||
}
|
||||
|
||||
operator fun setValue(instance: Any?, data: KProperty<*>, newValue: String) {
|
||||
value = newValue
|
||||
}
|
||||
}
|
||||
|
||||
var result: String by Delegate
|
||||
|
||||
fun box(): String {
|
||||
val f = ::result
|
||||
if (f.get() != "lol") return "Fail 1: {$f.get()}"
|
||||
Delegate.value = "rofl"
|
||||
if (f.get() != "rofl") return "Fail 2: {$f.get()}"
|
||||
f.set("OK")
|
||||
return f.get()
|
||||
}
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1290
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
import kotlin.reflect.KProperty1
|
||||
|
||||
class A {
|
||||
companion object {
|
||||
val ref: KProperty1<A, String> = A::foo
|
||||
}
|
||||
|
||||
val foo: String = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A.ref.get(A())
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1295
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
open class Base {
|
||||
open val foo = "Base"
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
override val foo = "OK"
|
||||
}
|
||||
|
||||
fun box() = (Base::foo).get(Derived())
|
||||
@@ -1,16 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1285
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
val String.id: String
|
||||
get() = this
|
||||
|
||||
fun box(): String {
|
||||
val pr = String::id
|
||||
|
||||
if (pr.get("123") != "123") return "Fail value: ${pr.get("123")}"
|
||||
|
||||
if (pr.name != "id") return "Fail name: ${pr.name}"
|
||||
|
||||
return pr.get("OK")
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1286
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
class A(val x: Int)
|
||||
|
||||
fun box(): String {
|
||||
val p = A::x
|
||||
if (p.get(A(42)) != 42) return "Fail 1"
|
||||
if (p.get(A(-1)) != -1) return "Fail 2"
|
||||
if (p.name != "x") return "Fail 3"
|
||||
return "OK"
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1287
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
var storage = 0
|
||||
|
||||
var Int.foo: Int
|
||||
get() {
|
||||
return this + storage
|
||||
}
|
||||
set(value) {
|
||||
storage = this + value
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val pr = Int::foo
|
||||
if (pr.get(42) != 42) return "Fail 1: ${pr.get(42)}"
|
||||
pr.set(200, 39)
|
||||
if (pr.get(-239) != 0) return "Fail 2: ${pr.get(-239)}"
|
||||
if (storage != 239) return "Fail 3: $storage"
|
||||
return "OK"
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1292
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
data class Box(var value: String)
|
||||
|
||||
fun box(): String {
|
||||
val o = Box("lorem")
|
||||
val prop = Box::value
|
||||
|
||||
if (prop.get(o) != "lorem") return "Fail 1: ${prop.get(o)}"
|
||||
prop.set(o, "ipsum")
|
||||
if (prop.get(o) != "ipsum") return "Fail 2: ${prop.get(o)}"
|
||||
if (o.value != "ipsum") return "Fail 3: ${o.value}"
|
||||
o.value = "dolor"
|
||||
if (prop.get(o) != "dolor") return "Fail 4: ${prop.get(o)}"
|
||||
if ("$o" != "Box(value=dolor)") return "Fail 5: $o"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1293
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
data class Box(val value: String)
|
||||
|
||||
var pr = Box("first")
|
||||
|
||||
fun box(): String {
|
||||
val property = ::pr
|
||||
if (property.get() != Box("first")) return "Fail value: ${property.get()}"
|
||||
if (property.name != "pr") return "Fail name: ${property.name}"
|
||||
property.set(Box("second"))
|
||||
if (property.get().value != "second") return "Fail value 2: ${property.get()}"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1293
|
||||
// This test was adapted from compiler/testData/codegen/box/callableReference/property/.
|
||||
package foo
|
||||
|
||||
data class Box(val value: String)
|
||||
|
||||
val foo = Box("lol")
|
||||
|
||||
fun box(): String {
|
||||
val property = ::foo
|
||||
if (property.get() != Box("lol")) return "Fail value: ${property.get()}"
|
||||
if (property.name != "foo") return "Fail name: ${property.name}"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user