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