tests: Update external tests (1.1.2-dev-393)
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
fun box(): String {
|
||||
OUTER@while (true) {
|
||||
var x = ""
|
||||
try {
|
||||
do {
|
||||
x = x + break@OUTER
|
||||
} while (true)
|
||||
} finally {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun box(): String {
|
||||
val ok: String? = "OK"
|
||||
var res = ""
|
||||
|
||||
do {
|
||||
res += ok ?: break
|
||||
} while (false)
|
||||
|
||||
return res
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun test(str: String): String {
|
||||
var s = ""
|
||||
for (i in 1..3) {
|
||||
s += if (i<2) str else break
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
fun box(): String = test("OK")
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun box(): String {
|
||||
var i = 0
|
||||
do continue while (i++ < 3)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun box(): String {
|
||||
var s = "OK"
|
||||
for (i in 1..3) {
|
||||
s = s + if (i<2) "" else continue
|
||||
}
|
||||
return s
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
inline fun bar(block: () -> String) : String {
|
||||
return block()
|
||||
}
|
||||
|
||||
inline fun bar2() : String {
|
||||
while (true) break
|
||||
return bar { return "def" }
|
||||
}
|
||||
|
||||
fun foobar(x: String, y: String, z: String) = x + y + z
|
||||
|
||||
fun box(): String {
|
||||
val test = foobar("abc", bar2(), "ghi")
|
||||
return if (test == "abcdefghi")
|
||||
"OK"
|
||||
else "Failed, test=$test"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun box(): String {
|
||||
var x = "OK"
|
||||
do {
|
||||
while (true) {
|
||||
x = x + break
|
||||
}
|
||||
} while (false)
|
||||
return x
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(x: String): String {
|
||||
var y: String
|
||||
do {
|
||||
y = x
|
||||
} while (y != x.bar(x))
|
||||
return y
|
||||
}
|
||||
|
||||
inline fun String.bar(other: String) = this
|
||||
|
||||
fun box(): String = foo("OK")
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
class MyQueue {
|
||||
fun poll(): String? = null
|
||||
}
|
||||
|
||||
class A {
|
||||
val delayedQueue = MyQueue()
|
||||
|
||||
fun next() {
|
||||
while (true) {
|
||||
delayedQueue.poll() ?: break
|
||||
}
|
||||
|
||||
while (true) {
|
||||
unblock(delayedQueue.poll() ?: break)
|
||||
}
|
||||
|
||||
while (true) {
|
||||
unblock(delayedQueue.poll() ?: break)
|
||||
}
|
||||
}
|
||||
|
||||
fun unblock(p: String) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
A().next()
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
class MyQueue {
|
||||
fun poll(): String? = null
|
||||
}
|
||||
|
||||
class A {
|
||||
val delayedQueue = MyQueue()
|
||||
|
||||
var cond = true
|
||||
|
||||
fun next() {
|
||||
while (cond) {
|
||||
delayedQueue.poll() ?: break
|
||||
}
|
||||
|
||||
while (cond) {
|
||||
unblock(delayedQueue.poll() ?: break)
|
||||
}
|
||||
|
||||
while (cond) {
|
||||
unblock(delayedQueue.poll() ?: break)
|
||||
}
|
||||
}
|
||||
|
||||
fun unblock(p: String) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
A().next()
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
fun box(): String {
|
||||
var cycle = true;
|
||||
while (true) {
|
||||
if (true && break) {
|
||||
return "fail"
|
||||
}
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
fun box(): String {
|
||||
var cycle = true;
|
||||
while (true) {
|
||||
if (true || break) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
return "fail"
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun box(): String {
|
||||
var flag = false
|
||||
do {
|
||||
if (flag) break
|
||||
continue
|
||||
} while (false)
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
fun foo(x: Long, y: Int, z: Double, s: String) {}
|
||||
|
||||
fun box(): String {
|
||||
while (true) {
|
||||
try {
|
||||
foo(0, 0, 0.0, "" + continue)
|
||||
}
|
||||
finally {
|
||||
foo(0, 0, 0.0, "" + break)
|
||||
}
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun box(): String {
|
||||
var x = "OK"
|
||||
while (true) {
|
||||
try {
|
||||
x = x + continue
|
||||
}
|
||||
finally {
|
||||
x = x + break
|
||||
}
|
||||
}
|
||||
return x
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun box(): String {
|
||||
var r = ""
|
||||
for (i in 1..1) {
|
||||
try {
|
||||
r += "O"
|
||||
break
|
||||
} finally {
|
||||
r += "K"
|
||||
continue
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
fun box(): String {
|
||||
while (true) break
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user