[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,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