JS backend tests: replace run with myRun in closure tests
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
package foo
|
||||
|
||||
fun myRun<T>(f: () -> T) = f()
|
||||
@@ -5,7 +5,7 @@ val r = "OK"
|
||||
fun simple(s: String? = null): String {
|
||||
if (s != null) return s
|
||||
|
||||
return run {
|
||||
return myRun {
|
||||
simple("OK")
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ val ok = "OK"
|
||||
fun withClosure(s: String? = null): String {
|
||||
if (s != null) return s
|
||||
|
||||
return ok + run {
|
||||
return ok + myRun {
|
||||
withClosure(ok)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ fun funfun(): Boolean {
|
||||
fun litlit(): Boolean {
|
||||
val result = true
|
||||
|
||||
return run {
|
||||
run { result }
|
||||
return myRun {
|
||||
myRun { result }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ fun funlit(): Boolean {
|
||||
val result = true
|
||||
|
||||
fun foo(): Boolean {
|
||||
return run { result }
|
||||
return myRun { result }
|
||||
}
|
||||
|
||||
return foo()
|
||||
@@ -32,7 +32,7 @@ fun funlit(): Boolean {
|
||||
fun litfun(): Boolean {
|
||||
val result = true
|
||||
|
||||
return run {
|
||||
return myRun {
|
||||
fun bar() = result
|
||||
bar()
|
||||
}
|
||||
@@ -45,4 +45,4 @@ fun box(): String {
|
||||
if (!litfun()) return "litfun failed"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -8,8 +8,8 @@ class A {
|
||||
|
||||
fun litlit() {
|
||||
val testName = "litlit"
|
||||
run {
|
||||
run {
|
||||
myRun {
|
||||
myRun {
|
||||
assertEquals(12, a, testName)
|
||||
|
||||
assertEquals(1, b, testName)
|
||||
@@ -40,7 +40,7 @@ class A {
|
||||
|
||||
fun litfun() {
|
||||
val testName = "litfun"
|
||||
run {
|
||||
myRun {
|
||||
fun bar() {
|
||||
assertEquals(12, a, testName)
|
||||
|
||||
@@ -57,7 +57,7 @@ class A {
|
||||
fun funlit() {
|
||||
val testName = "funlit"
|
||||
fun foo() {
|
||||
run {
|
||||
myRun {
|
||||
assertEquals(12, a, testName)
|
||||
|
||||
assertEquals(1, b, testName)
|
||||
@@ -78,4 +78,4 @@ fun box(): String {
|
||||
A().funlit()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package foo
|
||||
|
||||
fun box(): Boolean {
|
||||
val t = run {
|
||||
val t = myRun {
|
||||
object {
|
||||
fun boo(param: String): String {
|
||||
return run { param }
|
||||
return myRun { param }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ fun box(): String {
|
||||
fun simple(s: String? = null): String {
|
||||
if (s != null) return s
|
||||
|
||||
return run {
|
||||
return myRun {
|
||||
simple("OK")
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ fun box(): String {
|
||||
fun withClosure(s: String? = null): String {
|
||||
if (s != null) return s
|
||||
|
||||
return ok + run {
|
||||
return ok + myRun {
|
||||
withClosure(ok)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ class Foo {
|
||||
return
|
||||
}
|
||||
|
||||
run {
|
||||
myRun {
|
||||
bar(OK)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
package foo
|
||||
|
||||
public class Foo(val trigger: () -> Any) {
|
||||
fun test() = run {trigger()};
|
||||
fun test() = myRun { trigger() };
|
||||
}
|
||||
|
||||
fun box() = Foo({ "OK" }).test()
|
||||
|
||||
+2
-2
@@ -1,14 +1,14 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val t = run {
|
||||
val t = myRun {
|
||||
object {
|
||||
fun foo() = "3"
|
||||
|
||||
fun boo(param: String): String {
|
||||
val a = object {
|
||||
fun bar() = "57"
|
||||
fun b(): String = run { param + bar() + foo() }
|
||||
fun b(): String = myRun { param + bar() + foo() }
|
||||
}
|
||||
|
||||
return a.b()
|
||||
|
||||
Reference in New Issue
Block a user