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,6 +0,0 @@
inline fun test2Inline() = performWithFinally { "OK" }
fun box(): String {
return test2Inline()
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
inline fun <R> performWithFinally(finally: () -> R) : R {
try {
throw RuntimeException("1")
@@ -7,3 +9,11 @@ inline fun <R> performWithFinally(finally: () -> R) : R {
return finally()
}
}
// FILE: 2.kt
inline fun test2Inline() = performWithFinally { "OK" }
fun box(): String {
return test2Inline()
}
@@ -1,7 +0,0 @@
class My(val value: Int)
inline fun <T, R> T.perform(job: (T)-> R) : R {
return job(this)
}
public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this)
@@ -1,3 +1,15 @@
// FILE: 1.kt
class My(val value: Int)
inline fun <T, R> T.perform(job: (T)-> R) : R {
return job(this)
}
public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this)
// FILE: 2.kt
fun test1() : Int {
val inlineX = My(111)
var result = 0
@@ -50,4 +62,4 @@ fun box(): String {
if (test2() != -2) return "test2: ${test2()}"
return "OK"
}
}
@@ -1,19 +0,0 @@
class My(val value: Int)
inline fun <T, R> T.performWithFail(job: (T)-> R, failJob : (T) -> R) : R {
try {
return job(this)
} catch (e: RuntimeException) {
return failJob(this)
}
}
inline fun <T, R> T.performWithFail2(job: (T)-> R, failJob : (e: RuntimeException, T) -> R) : R {
try {
return job(this)
} catch (e: RuntimeException) {
return failJob(e, this)
}
}
public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this)
@@ -1,3 +1,27 @@
// FILE: 1.kt
class My(val value: Int)
inline fun <T, R> T.performWithFail(job: (T)-> R, failJob : (T) -> R) : R {
try {
return job(this)
} catch (e: RuntimeException) {
return failJob(this)
}
}
inline fun <T, R> T.performWithFail2(job: (T)-> R, failJob : (e: RuntimeException, T) -> R) : R {
try {
return job(this)
} catch (e: RuntimeException) {
return failJob(e, this)
}
}
public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this)
// FILE: 2.kt
fun test1(): Int {
val res = My(111).performWithFail<My, Int>(
{
@@ -104,4 +128,4 @@ fun box(): String {
if (test33() != -3) return "test33: ${test33()}"
return "OK"
}
}
@@ -1,21 +0,0 @@
class My(val value: Int)
inline fun <T, R> T.performWithFinally(job: (T)-> R, finally: (T) -> R) : R {
try {
return job(this)
} finally {
return finally(this)
}
}
inline fun <T, R> T.performWithFailFinally(job: (T)-> R, failJob : (e: RuntimeException, T) -> R, finally: (T) -> R) : R {
try {
return job(this)
} catch (e: RuntimeException) {
return failJob(e, this)
} finally {
return finally(this)
}
}
inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this)
@@ -1,3 +1,29 @@
// FILE: 1.kt
class My(val value: Int)
inline fun <T, R> T.performWithFinally(job: (T)-> R, finally: (T) -> R) : R {
try {
return job(this)
} finally {
return finally(this)
}
}
inline fun <T, R> T.performWithFailFinally(job: (T)-> R, failJob : (e: RuntimeException, T) -> R, finally: (T) -> R) : R {
try {
return job(this)
} catch (e: RuntimeException) {
return failJob(e, this)
} finally {
return finally(this)
}
}
inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this)
// FILE: 2.kt
fun test1(): Int {
var res = My(111).performWithFinally<My, Int>(
@@ -70,4 +96,4 @@ fun box(): String {
if (test3() != 113) return "test3: ${test3()}"
return "OK"
}
}