JS: move more test to box tests
This commit is contained in:
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
package foo
|
||||
|
||||
import java.util.*
|
||||
|
||||
class A<T>(val list: MutableList<T>) {
|
||||
fun addAll(c: Collection<T>) {
|
||||
list.addAll(c)
|
||||
}
|
||||
}
|
||||
|
||||
operator fun <T> A<T>.plusAssign(other: Collection<T>) {
|
||||
addAll(other)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var v1 = arrayListOf("foo")
|
||||
val v2 = listOf("bar")
|
||||
|
||||
val a = A(v1)
|
||||
a += v2
|
||||
|
||||
if (v1.size != 2) return "fail1: ${v1.size}"
|
||||
if (v1[0] != "foo") return "fail2: ${v1[0]}"
|
||||
if (v1[1] != "bar") return "fail3: ${v1[1]}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user