JS test: added inline tests

This commit is contained in:
Alexey Tsvetkov
2014-09-29 16:00:18 +04:00
committed by Zalim Bashorov
parent 987708680f
commit 3f2d4b31be
112 changed files with 4442 additions and 0 deletions
@@ -0,0 +1,43 @@
/*
* Copy of JVM-backend test
* Found at: compiler/testData/codegen/boxInline/simple/classObject.1.kt
*/
package foo
inline fun inline(s: () -> String): String {
return s()
}
class InlineAll {
inline fun inline(s: () -> String): String {
return s()
}
class object {
inline fun inline(s: () -> String): String {
return s()
}
}
}
fun testClassObjectCall(): String {
return InlineAll.inline({"classobject"})
}
fun testInstanceCall(): String {
val inlineX = InlineAll()
return inlineX.inline({"instance"})
}
fun testPackageCall(): String {
return inline({"package"})
}
fun box(): String {
if (testClassObjectCall() != "classobject") return "test1: ${testClassObjectCall()}"
if (testInstanceCall() != "instance") return "test2: ${testInstanceCall()}"
if (testPackageCall() != "package") return "test3: ${testPackageCall()}"
return "OK"
}