backend/tests: Add blackbox tests from Kotlin JVM

Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
This commit is contained in:
Ilya Matveev
2017-01-12 19:43:20 +07:00
parent d5988297b1
commit 1b553ebfaf
2643 changed files with 66666 additions and 0 deletions
@@ -0,0 +1,27 @@
// WITH_RUNTIME
class ArrayWrapper<T>() {
val contents = ArrayList<T>()
fun add(item: T) {
contents.add(item)
}
operator fun unaryMinus(): ArrayWrapper<T> {
val result = ArrayWrapper<T>()
result.contents.addAll(contents)
result.contents.reverse()
return result
}
operator fun get(index: Int): T {
return contents.get(index)!!
}
}
fun box(): String {
val v1 = ArrayWrapper<String>()
v1.add("foo")
v1.add("bar")
val v2 = -v1
return if (v2[0] == "bar" && v2[1] == "foo") "OK" else "fail"
}