Migrate boxInline tests to new multi-file framework

This commit is contained in:
Alexander Udalov
2016-02-24 13:29:32 +03:00
committed by Alexander Udalov
parent fa1f7d988e
commit cc84aabdcf
586 changed files with 6946 additions and 5639 deletions
@@ -1,7 +0,0 @@
class Inline() {
inline fun foo(closure1 : (l: Int) -> String, param: Int, closure2: String.() -> Int) : Int {
return closure1(param).closure2()
}
}
@@ -1,3 +1,14 @@
// FILE: 1.kt
class Inline() {
inline fun foo(closure1 : (l: Int) -> String, param: Int, closure2: String.() -> Int) : Int {
return closure1(param).closure2()
}
}
// FILE: 2.kt
fun test1(): Int {
val inlineX = Inline()
return inlineX.foo({ z: Int -> "" + z}, 25, fun String.(): Int = this.length)
@@ -1,23 +0,0 @@
import test.*
import java.util.*
fun sample(): Input {
return Input("Hello", "World");
}
fun testForEachLine() {
val list = ArrayList<String>()
val reader = sample()
reader.forEachLine{
list.add(it)
}
}
fun box(): String {
testForEachLine()
return "OK"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
public class Input(val s1: String, val s2: String) {
@@ -17,3 +19,29 @@ public inline fun Input.forEachLine(block: (String) -> Unit): Unit {
public inline fun Input.useLines(block2: (Iterator<String>) -> Unit): Unit {
this.use{ block2(it.iterator()) }
}
// FILE: 2.kt
import test.*
import java.util.*
fun sample(): Input {
return Input("Hello", "World");
}
fun testForEachLine() {
val list = ArrayList<String>()
val reader = sample()
reader.forEachLine{
list.add(it)
}
}
fun box(): String {
testForEachLine()
return "OK"
}
@@ -1,23 +0,0 @@
import test.*
import java.util.*
fun sample(): Input {
return Input("Hello", "World");
}
fun testForEachLine() {
val list = ArrayList<String>()
val reader = sample()
reader.forEachLine{
list.add("111")
}
}
fun box(): String {
testForEachLine()
return "OK"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
public class Input(val s1: String, val s2: String) {
@@ -17,3 +19,29 @@ public inline fun <T, R> T.use2(block: ()-> R) : R {
public inline fun Input.forEachLine(block: () -> Unit): Unit {
use { use2 (block) }
}
// FILE: 2.kt
import test.*
import java.util.*
fun sample(): Input {
return Input("Hello", "World");
}
fun testForEachLine() {
val list = ArrayList<String>()
val reader = sample()
reader.forEachLine{
list.add("111")
}
}
fun box(): String {
testForEachLine()
return "OK"
}
-22
View File
@@ -1,22 +0,0 @@
import test.*
fun Data.test1(d: Data) : Long {
val input2 = Input(this)
val input = Input(this)
return input.use<Input, Long>{
val output = Output(d)
output.use<Output,Long>{
input.copyTo(output, 10)
}
}
}
fun box(): String {
val result = Data().test1(Data())
if (result != 100.toLong()) return "test1: ${result}"
return "OK"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
public class Data()
@@ -36,3 +38,28 @@ public inline fun <T: Closeable, R> T.use(block: (T)-> R) : R {
public fun Input.copyTo(output: Output, size: Int): Long {
return output.doOutput(this.data()).toLong()
}
// FILE: 2.kt
import test.*
fun Data.test1(d: Data) : Long {
val input2 = Input(this)
val input = Input(this)
return input.use<Input, Long>{
val output = Output(d)
output.use<Output,Long>{
input.copyTo(output, 10)
}
}
}
fun box(): String {
val result = Data().test1(Data())
if (result != 100.toLong()) return "test1: ${result}"
return "OK"
}
-31
View File
@@ -1,31 +0,0 @@
package test
public class Data()
public class Input(val d: Data) : Closeable {
public fun data() : Int = 100
}
public class Output(val d: Data) : Closeable {
public fun doOutput(data: Int): Int = data
}
public interface Closeable {
open public fun close() {}
}
public inline fun <R> use(block: ()-> R) : R {
return block()
}
public fun <R> useNoInline(block: ()-> R) : R {
return block()
}
public fun Input.copyTo(output: Output, size: Int): Long {
return output.doOutput(this.data()).toLong()
}
public inline fun <T> with2(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}()
@@ -1,3 +1,39 @@
// FILE: 1.kt
package test
public class Data()
public class Input(val d: Data) : Closeable {
public fun data() : Int = 100
}
public class Output(val d: Data) : Closeable {
public fun doOutput(data: Int): Int = data
}
public interface Closeable {
open public fun close() {}
}
public inline fun <R> use(block: ()-> R) : R {
return block()
}
public fun <R> useNoInline(block: ()-> R) : R {
return block()
}
public fun Input.copyTo(output: Output, size: Int): Long {
return output.doOutput(this.data()).toLong()
}
public inline fun <T> with2(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}()
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
import test.*