tests: Update external tests (1.1.2-dev-393)

This commit is contained in:
Ilya Matveev
2017-03-13 12:38:08 +03:00
committed by ilmat192
parent ac56fccb15
commit bc074e6d39
3178 changed files with 22396 additions and 696 deletions
@@ -0,0 +1,28 @@
// FILE: 1.kt
// WITH_RUNTIME
package test
object ContentTypeByExtension {
inline fun processRecords(crossinline operation: (String) -> String) =
listOf("O", "K").map {
val ext = B(it)
operation(ext.toLowerCase())
}.joinToString("")
}
inline fun A.toLowerCase(): String = (this as B).value
open class A
open class B(val value: String) : A()
// FILE: 2.kt
import test.*
fun box(): String {
return ContentTypeByExtension.processRecords { ext -> ext }
}
@@ -0,0 +1,28 @@
// FILE: 1.kt
package test
object ContentTypeByExtension {
inline fun processRecords(crossinline operation: (String) -> String) =
{
val ext = B("OK")
operation(ext.toLowerCase())
}()
}
inline fun A.toLowerCase(): String = (this as B).value
open class A
open class B(val value: String) : A()
// FILE: 2.kt
import test.*
fun box(): String {
return ContentTypeByExtension.processRecords { ext -> ext }
}
@@ -0,0 +1,15 @@
// FILE: 1.kt
package test
inline fun foo(x: String) = x
inline fun processRecords(block: (String) -> String) = block(foo("O"))
// FILE: 2.kt
import test.*
fun box(): String {
return processRecords { ext -> ext + "K" }
}
@@ -0,0 +1,21 @@
// FILE: 1.kt
package test
inline fun foo(x: String) = x
class A {
fun test(s: String) = s
}
inline fun processRecords(block: (String) -> String): String {
return A().test(block(foo("K")))
}
// FILE: 2.kt
import test.*
fun box(): String {
return processRecords { "O" + it }
}
@@ -0,0 +1,23 @@
// FILE: 1.kt
package test
inline fun foo(x: String, y: String) = x + y
class A {
fun test(s: String) = s
}
inline fun processRecords(block: (String) -> String): String {
return A().test(block(foo("O", foo("K", "1"))))
}
// FILE: 2.kt
import test.*
fun box(): String {
val result = processRecords { "B" + it }
return if (result == "BOK1") "OK" else "fail: $result"
}
@@ -0,0 +1,20 @@
// FILE: 1.kt
package test
inline fun foo(x: String) = x
fun test(a: String, s: String) = s
inline fun processRecords(block: (String, String) -> String): String {
return test("stub", block(foo("O"), foo("K")))
}
// FILE: 2.kt
import test.*
fun box(): String {
return processRecords { a, b -> a + b}
}
@@ -0,0 +1,15 @@
// FILE: 1.kt
package test
inline fun foo(x: String) = x
inline fun processRecords(s: String?, block: String.(String) -> String) = s?.block(foo("O"))
// FILE: 2.kt
import test.*
fun box(): String? {
return processRecords("O") { this + "K" }
}