Move some tests from boxWithStdlib/ to box/
Move those tests which do not require neither stdlib nor reflect
This commit is contained in:
committed by
Alexander Udalov
parent
54a615fcd3
commit
20e36438e2
@@ -0,0 +1,7 @@
|
||||
data class A(val x: Int) {
|
||||
override fun toString(): String = "!"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return if (A(0).toString() == "!") "OK" else "fail"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
data class A(val x: Array<Int>?, val y: IntArray?)
|
||||
|
||||
fun box(): String {
|
||||
var ts = A(Array<Int>(2, {it}), IntArray(3)).toString()
|
||||
if(ts != "A(x=[0, 1], y=[0, 0, 0])") return ts
|
||||
|
||||
ts = A(null, IntArray(3)).toString()
|
||||
if(ts != "A(x=null, y=[0, 0, 0])") return ts
|
||||
|
||||
ts = A(null, null).toString()
|
||||
if(ts != "A(x=null, y=null)") return ts
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
data class A(var string: String)
|
||||
|
||||
fun box(): String {
|
||||
val a = A("Fail")
|
||||
if(a.toString() != "A(string=Fail)") return "fail"
|
||||
|
||||
a.string = "OK"
|
||||
if("$a" != "A(string=OK)") return a.toString()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
data class A<T>(val x: T)
|
||||
|
||||
fun box(): String {
|
||||
val a = A(42)
|
||||
if ("$a" != "A(x=42)") return "$a"
|
||||
|
||||
val b = A(239.toLong())
|
||||
if ("$b" != "A(x=239)") return "$b"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
data class A(var x: Int, val z: Int?)
|
||||
|
||||
fun box(): String {
|
||||
val a = A(1, null)
|
||||
if("$a" != "A(x=1, z=null)") return "$a"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
data class A(val x: Unit)
|
||||
|
||||
fun box(): String {
|
||||
val a = A(Unit)
|
||||
return if ("$a" == "A(x=kotlin.Unit)") "OK" else "$a"
|
||||
}
|
||||
Reference in New Issue
Block a user