[K/N][Tests] Adjust moved tests interfaceCallsNCasts..vector to new infra

^KT-61259
This commit is contained in:
Vladimir Sukharev
2023-12-16 23:54:04 +01:00
committed by Space Team
parent 93642020ff
commit bb8a7b6795
163 changed files with 841 additions and 672 deletions
+15 -7
View File
@@ -3,18 +3,26 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.catch3
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
println("Before")
sb.appendLine("Before")
throw Error("Error happens")
println("After")
sb.appendLine("After")
} catch (e: Throwable) {
println("Caught Throwable")
sb.appendLine("Caught Throwable")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Before
Caught Throwable
Done
""".trimIndent(), sb.toString())
return "OK"
}
-3
View File
@@ -1,3 +0,0 @@
Before
Caught Throwable
Done
+17 -9
View File
@@ -3,22 +3,30 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.catch4
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
println("Before")
sb.appendLine("Before")
throw Error("Error happens")
println("After")
sb.appendLine("After")
} catch (e: Exception) {
println("Caught Exception")
sb.appendLine("Caught Exception")
} catch (e: Error) {
println("Caught Error")
sb.appendLine("Caught Error")
} catch (e: Throwable) {
println("Caught Throwable")
sb.appendLine("Caught Throwable")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Before
Caught Error
Done
""".trimIndent(), sb.toString())
return "OK"
}
-3
View File
@@ -1,3 +0,0 @@
Before
Caught Error
Done
+19 -11
View File
@@ -3,32 +3,40 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.catch5
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
try {
println("Before")
sb.appendLine("Before")
foo()
println("After")
sb.appendLine("After")
} catch (e: Exception) {
println("Caught Exception")
sb.appendLine("Caught Exception")
}
println("After nested try")
sb.appendLine("After nested try")
} catch (e: Error) {
println("Caught Error")
sb.appendLine("Caught Error")
} catch (e: Throwable) {
println("Caught Throwable")
sb.appendLine("Caught Throwable")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Before
Caught Error
Done
""".trimIndent(), sb.toString())
return "OK"
}
fun foo() {
throw Error("Error happens")
println("After in foo()")
sb.appendLine("After in foo()")
}
-3
View File
@@ -1,3 +0,0 @@
Before
Caught Error
Done
+17 -9
View File
@@ -3,28 +3,36 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.catch6
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
println("Before")
sb.appendLine("Before")
foo()
println("After")
sb.appendLine("After")
} catch (e: Exception) {
println("Caught Exception")
sb.appendLine("Caught Exception")
} catch (e: Error) {
println("Caught Error")
sb.appendLine("Caught Error")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Before
Caught Error
Done
""".trimIndent(), sb.toString())
return "OK"
}
fun foo() {
try {
throw Error("Error happens")
} catch (e: Exception) {
println("Caught Exception")
sb.appendLine("Caught Exception")
}
}
-3
View File
@@ -1,3 +0,0 @@
Before
Caught Error
Done
+10 -4
View File
@@ -3,17 +3,23 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.catch8
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
throw Error("Error happens")
} catch (e: Throwable) {
val message = e.message
if (message != null) {
println(message)
sb.appendLine(message)
}
}
assertEquals("""
Error happens
""".trimIndent(), sb.toString())
return "OK"
}
-1
View File
@@ -1 +0,0 @@
Error happens
+14 -6
View File
@@ -3,17 +3,25 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally1
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
println("Try")
sb.appendLine("Try")
} finally {
println("Finally")
sb.appendLine("Finally")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Try
Finally
Done
""".trimIndent(), sb.toString())
return "OK"
}
-3
View File
@@ -1,3 +0,0 @@
Try
Finally
Done
+12 -5
View File
@@ -3,19 +3,26 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally10
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
while (true) {
try {
continue
} finally {
println("Finally")
sb.appendLine("Finally")
break
}
}
println("After")
sb.appendLine("After")
assertEquals("""
Finally
After
""".trimIndent(), sb.toString())
return "OK"
}
@@ -1,2 +0,0 @@
Finally
After
+19 -7
View File
@@ -3,23 +3,35 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally11
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
test()
assertEquals("""
Finally
Catch 2
Done
""".trimIndent(), sb.toString())
return "OK"
}
fun test() {
try {
try {
return
} catch (e: Error) {
println("Catch 1")
sb.appendLine("Catch 1")
} finally {
println("Finally")
sb.appendLine("Finally")
throw Error()
}
} catch (e: Error) {
println("Catch 2")
sb.appendLine("Catch 2")
}
println("Done")
sb.appendLine("Done")
}
@@ -1,3 +0,0 @@
Finally
Catch 2
Done
+17 -8
View File
@@ -3,21 +3,30 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally2
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
println("Try")
sb.appendLine("Try")
throw Error("Error happens")
println("After throw")
sb.appendLine("After throw")
} catch (e: Error) {
println("Caught Error")
sb.appendLine("Caught Error")
} finally {
println("Finally")
sb.appendLine("Finally")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Try
Caught Error
Finally
Done
""".trimIndent(), sb.toString())
return "OK"
}
-4
View File
@@ -1,4 +0,0 @@
Try
Caught Error
Finally
Done
+18 -9
View File
@@ -3,26 +3,35 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally3
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
try {
println("Try")
sb.appendLine("Try")
throw Error("Error happens")
println("After throw")
sb.appendLine("After throw")
} finally {
println("Finally")
sb.appendLine("Finally")
}
println("After nested try")
sb.appendLine("After nested try")
} catch (e: Error) {
println("Caught Error")
sb.appendLine("Caught Error")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Try
Finally
Caught Error
Done
""".trimIndent(), sb.toString())
return "OK"
}
-4
View File
@@ -1,4 +0,0 @@
Try
Finally
Caught Error
Done
+22 -12
View File
@@ -3,32 +3,42 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally4
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
try {
try {
println("Try")
sb.appendLine("Try")
throw Error("Error happens")
println("After throw")
sb.appendLine("After throw")
} catch (e: Error) {
println("Catch")
sb.appendLine("Catch")
throw Exception()
println("After throw")
sb.appendLine("After throw")
} finally {
println("Finally")
sb.appendLine("Finally")
}
println("After nested try")
sb.appendLine("After nested try")
} catch (e: Error) {
println("Caught Error")
sb.appendLine("Caught Error")
} catch (e: Exception) {
println("Caught Exception")
sb.appendLine("Caught Exception")
}
println("Done")
sb.appendLine("Done")
assertEquals("""
Try
Catch
Finally
Caught Exception
Done
""".trimIndent(), sb.toString())
return "OK"
}
-5
View File
@@ -1,5 +0,0 @@
Try
Catch
Finally
Caught Exception
Done
+15 -7
View File
@@ -3,22 +3,30 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally5
import kotlin.test.*
@Test fun runTest() {
println(foo())
val sb = StringBuilder()
fun box(): String {
sb.appendLine(foo())
assertEquals("""
Done
Finally
0
""".trimIndent(), sb.toString())
return "OK"
}
fun foo(): Int {
try {
println("Done")
sb.appendLine("Done")
return 0
} finally {
println("Finally")
sb.appendLine("Finally")
}
println("After")
sb.appendLine("After")
return 1
}
-3
View File
@@ -1,3 +0,0 @@
Done
Finally
0
+15 -7
View File
@@ -3,23 +3,31 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally6
import kotlin.test.*
@Test fun runTest() {
println(foo())
val sb = StringBuilder()
fun box(): String {
sb.appendLine(foo())
assertEquals("""
Done
Finally
1
""".trimIndent(), sb.toString())
return "OK"
}
fun foo(): Int {
try {
println("Done")
sb.appendLine("Done")
return 0
} finally {
println("Finally")
sb.appendLine("Finally")
return 1
}
println("After")
sb.appendLine("After")
return 2
}
-3
View File
@@ -1,3 +0,0 @@
Done
Finally
1
+14 -7
View File
@@ -3,23 +3,30 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally7
import kotlin.test.*
@Test fun runTest() {
println(foo())
val sb = StringBuilder()
fun box(): String {
sb.appendLine(foo())
assertEquals("""
Done
Finally
1
""".trimIndent(), sb.toString())
return "OK"
}
fun foo(): Int {
try {
println("Done")
sb.appendLine("Done")
throw Error()
} finally {
println("Finally")
sb.appendLine("Finally")
return 1
}
println("After")
sb.appendLine("After")
return 2
}
-3
View File
@@ -1,3 +0,0 @@
Done
Finally
1
+15 -7
View File
@@ -3,12 +3,20 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally8
import kotlin.test.*
@Test fun runTest() {
println(foo())
val sb = StringBuilder()
fun box(): String {
sb.appendLine(foo())
assertEquals("""
Finally 1
Finally 2
42
""".trimIndent(), sb.toString())
return "OK"
}
fun foo(): Int {
@@ -16,12 +24,12 @@ fun foo(): Int {
try {
return 42
} finally {
println("Finally 1")
sb.appendLine("Finally 1")
}
} finally {
println("Finally 2")
sb.appendLine("Finally 2")
}
println("After")
sb.appendLine("After")
return 2
}
-3
View File
@@ -1,3 +0,0 @@
Finally 1
Finally 2
42
+14 -6
View File
@@ -3,16 +3,16 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.finally9
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
do {
try {
break
} finally {
println("Finally 1")
sb.appendLine("Finally 1")
}
} while (false)
@@ -22,9 +22,17 @@ import kotlin.test.*
stop = true
continue
} finally {
println("Finally 2")
sb.appendLine("Finally 2")
}
}
println("After")
sb.appendLine("After")
assertEquals("""
Finally 1
Finally 2
After
""".trimIndent(), sb.toString())
return "OK"
}
-3
View File
@@ -1,3 +0,0 @@
Finally 1
Finally 2
After
@@ -3,10 +3,10 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.returnsDifferentTypes
import kotlin.test.*
val sb = StringBuilder()
class ReceiveChannel<out E>
inline fun <E, R> ReceiveChannel<E>.consume(block: ReceiveChannel<E>.() -> R): R {
@@ -14,7 +14,7 @@ inline fun <E, R> ReceiveChannel<E>.consume(block: ReceiveChannel<E>.() -> R): R
return block()
}
finally {
println("zzz")
sb.appendLine("zzz")
}
}
@@ -28,6 +28,13 @@ inline fun <E> ReceiveChannel<E>.elementAtOrElse(index: Int, defaultValue: (Int)
fun <E> ReceiveChannel<E>.elementAt(index: Int): E =
elementAtOrElse(index) { throw IndexOutOfBoundsException("qxx") }
@Test fun runTest() {
println(ReceiveChannel<Int>().elementAt(0))
fun box(): String {
sb.appendLine(ReceiveChannel<Int>().elementAt(0))
assertEquals("""
zzz
42
""".trimIndent(), sb.toString())
return "OK"
}
@@ -1,2 +0,0 @@
zzz
42
+3 -4
View File
@@ -3,16 +3,15 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.try1
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
val x = try {
5
} catch (e: Throwable) {
6
}
println(x)
assertEquals(5, x)
return "OK"
}
-1
View File
@@ -1 +0,0 @@
5
+3 -4
View File
@@ -3,11 +3,9 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.try2
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
val x = try {
throw Error()
5
@@ -15,5 +13,6 @@ import kotlin.test.*
6
}
println(x)
assertEquals(6, x)
return "OK"
}
-1
View File
@@ -1 +0,0 @@
6
+3 -4
View File
@@ -3,16 +3,15 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.try3
import kotlin.test.*
@Test fun runTest() {
fun box(): String {
val x = try {
throw Error()
} catch (e: Throwable) {
6
}
println(x)
assertEquals(6, x)
return "OK"
}
-1
View File
@@ -1 +0,0 @@
6
+12 -5
View File
@@ -3,17 +3,24 @@
* that can be found in the LICENSE file.
*/
package codegen.`try`.try4
import kotlin.test.*
@Test fun runTest() {
val sb = StringBuilder()
fun box(): String {
val x = try {
println("Try")
sb.appendLine("Try")
5
} catch (e: Throwable) {
throw e
}
println(x)
sb.appendLine(x)
assertEquals("""
Try
5
""".trimIndent(), sb.toString())
return "OK"
}
-2
View File
@@ -1,2 +0,0 @@
Try
5