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,21 @@
var result = "fail"
private operator fun X.get(name: String) = name + "K"
private operator fun X.set(name: String, v: String) {
result = v
}
class X {
fun test() : String {
if (this["O"] != "OK") return "fail 1: ${this["O"]}"
this["O"] += "K"
if (result != "OKK") return "fail 2: ${result}"
return "OK"
}
}
fun box(): String {
return X().test()
}
@@ -0,0 +1,15 @@
class MyString(var content : String)
object Greeter {
fun sayHello(name : String): String {
var result = MyString(name)
result += "K"
return result.content
}
}
private operator fun MyString.plus(suffix: String) : MyString = MyString("${this.content}$suffix")
fun box(): String {
return Greeter.sayHello("O")
}