[K/N][tests] Migrate console runtime tests to new testing infra ^KT-61259

This commit is contained in:
Alexander Shabalin
2023-11-01 13:32:25 +01:00
committed by Space Team
parent 2abf9bccba
commit 6ca8f546fe
62 changed files with 311 additions and 347 deletions
@@ -1,2 +0,0 @@
runtime/basic/readln*CR*.in binary
runtime/basic/readln*CR*.out binary
@@ -612,92 +612,10 @@ tasks.register("codegen_vector_default_argument", KonanLocalTest) {
source = "codegen/vector/default_argument.kt"
}
tasks.register("hello0", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/hello0.kt"
}
tasks.register("stringTrim", KonanLocalTest) {
source = "codegen/stringTrim/stringTrim.kt"
}
standaloneTest("hello1") {
useGoldenData = true
useTestData = true
source = "runtime/basic/hello1.kt"
}
standaloneTest("hello2") {
useGoldenData = true
useTestData = true
source = "runtime/basic/hello2.kt"
}
standaloneTest("readlnOrNull_empty") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readlnOrNull_empty.kt"
}
standaloneTest("readln_empty") {
useTestData = true
outputChecker = { s -> s.contains("ReadAfterEOFException") }
expectedExitStatusChecker = { it != 0 }
source = "runtime/basic/readln_empty.kt"
}
standaloneTest("readln_alone_CR") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readln_alone_CR.kt"
}
standaloneTest("readln_empty_new_line") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readln_empty_new_line.kt"
}
standaloneTest("readln_multiline") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readln_multiline.kt"
}
standaloneTest("readln_CR_and_CRLF") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readln_CR_and_CRLF.kt"
}
standaloneTest("readln_long_line") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readln_long_line.kt"
}
standaloneTest("readln_cyrillic") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readln_cyrillic.kt"
}
standaloneTest("readln_multiple_empty_new_lines") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readln_multiple_empty_new_lines.kt"
}
tasks.register("hello3", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/hello3.kt"
}
tasks.register("hello4", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/hello4.kt"
}
standaloneTest('enumEquals') {
useGoldenData = true
source = "runtime/basic/enum_equals.kt"
@@ -734,18 +652,6 @@ standaloneTest("entry4") {
source = "runtime/basic/entry4.kt"
}
standaloneTest("readline0") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readline0.kt"
}
standaloneTest("readline1") {
useGoldenData = true
useTestData = true
source = "runtime/basic/readline1.kt"
}
standaloneTest("cleaner_basic") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_basic.kt"
@@ -2049,11 +1955,6 @@ linkTest("lib@name") {
lib = "link/klib_name/lib.kt"
}
tasks.register("for0", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/for0.kt"
}
tasks.register("throw0", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/throw0.kt"
@@ -2170,11 +2071,6 @@ tasks.register("listof1", KonanLocalTest) {
source = "datagen/literals/listof1.kt"
}
tasks.register("print_utf8", KonanLocalTest) {
useGoldenData = true
source = "runtime/basic/print_utf8.kt"
}
tasks.register("catch1", KonanLocalTest) {
useGoldenData = true
source = "runtime/exceptions/catch1.kt"
@@ -1,18 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.for0
import kotlin.test.*
@Test fun runTest() {
val byteArray = ByteArray(3)
byteArray[0] = 2
byteArray[1] = 3
byteArray[2] = 4
for (item in byteArray) {
println(item)
}
}
@@ -1,3 +0,0 @@
2
3
4
@@ -1,12 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.hello0
import kotlin.test.*
@Test fun runTest() {
println("Hello, world!")
}
@@ -1 +0,0 @@
Hello, world!
@@ -1 +0,0 @@
Hello World
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TODO: TestRuner should be able to pass input to stdin
// TODO: remove kotlin_native.io once overrides are in place.
fun main(args: Array<String>) {
print(readLine().toString())
}
@@ -1 +0,0 @@
Hello World
@@ -1 +0,0 @@
Hello World
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
// TODO: TestRuner should be able to pass input to stdin
// TODO: remove kotlin_native.io once overrides are in place.
fun main(args : Array<String>) {
print("you entered '" + readLine() + "'")
}
@@ -1 +0,0 @@
you entered 'Hello World'
@@ -1,16 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.hello3
import kotlin.test.*
@Test fun runTest() {
println(239)
// TODO: enable, once override by name is implemented.
println(true)
println(3.14159)
println('A')
}
@@ -1,4 +0,0 @@
239
true
3.14159
A
@@ -1,14 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package runtime.basic.hello4
import kotlin.test.*
@Test fun runTest() {
val x = 2
println(if (x == 2) "Hello" else "Привет")
println(if (x == 3) "Bye" else "Пока")
}
@@ -1,2 +0,0 @@
Hello
Пока
@@ -1,37 +0,0 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package runtime.basic.print_utf8
import kotlin.test.*
import kotlinx.cinterop.toKString
fun convertUtf8to16(byteArray: ByteArray, action: (String) -> Unit) {
byteArray.decodeToString().let { action(it) }
byteArray.toKString().let { action(it) }
}
@Test
fun testPrint() {
// Valid strings.
println("Hello")
println("Привет")
println("\uD800\uDC00")
println("")
// Illegal surrogate pair -> default output
println("\uDC00\uD800")
// Lone surrogate -> default output
println("\uD80012")
println("\uDC0012")
println("12\uD800")
// https://github.com/JetBrains/kotlin-native/issues/1091
val array = byteArrayOf(0xF0.toByte(), 0x9F.toByte(), 0x98.toByte(), 0xA5.toByte())
convertUtf8to16(array) { badString ->
assertEquals(2, badString.length)
println(badString)
}
}
@@ -1,10 +0,0 @@
Hello
Привет
𐀀
12
12
12
😥
😥
@@ -1 +0,0 @@
41
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun main(args: Array<String>) {
print(readLine()!!.toInt())
}
@@ -1 +0,0 @@
41
@@ -1 +0,0 @@
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun main(args: Array<String>) {
print(readLine()!!)
}
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
fun main() {
print("${readlnOrNull()}/${readlnOrNull()}/${readlnOrNull()}")
}
@@ -1 +0,0 @@
null/null/null
@@ -1,2 +0,0 @@
aaaaaa
bbb
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
print(readln())
}
@@ -1 +0,0 @@
aaaaaa
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
print(readln())
}
@@ -1 +0,0 @@
Привет!
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
print(readln())
}
@@ -1 +0,0 @@
Привет!
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
readln()
}
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
print(readln())
}
@@ -1 +0,0 @@
A very long line of input with length of more than initial buffer size
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
print(readln())
}
@@ -1 +0,0 @@
A very long line of input with length of more than initial buffer size
@@ -1,3 +0,0 @@
Hello World
Second line
Third line
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
print(readln())
}
@@ -1 +0,0 @@
Hello World
@@ -1,4 +0,0 @@
first
second
@@ -1,8 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
fun main() {
print("${readln()}/${readln()}/${readln()}/${readln()}/${readlnOrNull()}")
}
@@ -1 +0,0 @@
first/second///null