[K/N][tests] Migrate console runtime tests to new testing infra ^KT-61259
This commit is contained in:
committed by
Space Team
parent
2abf9bccba
commit
6ca8f546fe
@@ -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"
|
source = "codegen/vector/default_argument.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("hello0", KonanLocalTest) {
|
|
||||||
useGoldenData = true
|
|
||||||
source = "runtime/basic/hello0.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("stringTrim", KonanLocalTest) {
|
tasks.register("stringTrim", KonanLocalTest) {
|
||||||
source = "codegen/stringTrim/stringTrim.kt"
|
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') {
|
standaloneTest('enumEquals') {
|
||||||
useGoldenData = true
|
useGoldenData = true
|
||||||
source = "runtime/basic/enum_equals.kt"
|
source = "runtime/basic/enum_equals.kt"
|
||||||
@@ -734,18 +652,6 @@ standaloneTest("entry4") {
|
|||||||
source = "runtime/basic/entry4.kt"
|
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") {
|
standaloneTest("cleaner_basic") {
|
||||||
enabled = !isNoopGC
|
enabled = !isNoopGC
|
||||||
source = "runtime/basic/cleaner_basic.kt"
|
source = "runtime/basic/cleaner_basic.kt"
|
||||||
@@ -2049,11 +1955,6 @@ linkTest("lib@name") {
|
|||||||
lib = "link/klib_name/lib.kt"
|
lib = "link/klib_name/lib.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("for0", KonanLocalTest) {
|
|
||||||
useGoldenData = true
|
|
||||||
source = "runtime/basic/for0.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("throw0", KonanLocalTest) {
|
tasks.register("throw0", KonanLocalTest) {
|
||||||
useGoldenData = true
|
useGoldenData = true
|
||||||
source = "runtime/basic/throw0.kt"
|
source = "runtime/basic/throw0.kt"
|
||||||
@@ -2170,11 +2071,6 @@ tasks.register("listof1", KonanLocalTest) {
|
|||||||
source = "datagen/literals/listof1.kt"
|
source = "datagen/literals/listof1.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("print_utf8", KonanLocalTest) {
|
|
||||||
useGoldenData = true
|
|
||||||
source = "runtime/basic/print_utf8.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("catch1", KonanLocalTest) {
|
tasks.register("catch1", KonanLocalTest) {
|
||||||
useGoldenData = true
|
useGoldenData = true
|
||||||
source = "runtime/exceptions/catch1.kt"
|
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,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 +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,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 +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 @@
|
|||||||
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,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
|
|
||||||
@@ -52,6 +52,7 @@ val cinteropTest = nativeTest("cinteropTest", "cinterop")
|
|||||||
val debuggerTest = nativeTest("debuggerTest", "debugger")
|
val debuggerTest = nativeTest("debuggerTest", "debugger")
|
||||||
val cachesTest = nativeTest("cachesTest", "caches")
|
val cachesTest = nativeTest("cachesTest", "caches")
|
||||||
val klibTest = nativeTest("klibTest", "klib")
|
val klibTest = nativeTest("klibTest", "klib")
|
||||||
|
val standaloneTest = nativeTest("standaloneTest", "standalone")
|
||||||
|
|
||||||
val testTags = findProperty("kotlin.native.tests.tags")?.toString()
|
val testTags = findProperty("kotlin.native.tests.tags")?.toString()
|
||||||
// Note: arbitrary JUnit tag expressions can be used in this property.
|
// Note: arbitrary JUnit tag expressions can be used in this property.
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
*.in binary
|
||||||
|
*.out binary
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// OUTPUT_DATA_FILE: println.out
|
||||||
|
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||||
|
|
||||||
|
import kotlinx.cinterop.toKString
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
println("Hello, world!")
|
||||||
|
println(123.toByte())
|
||||||
|
println(239)
|
||||||
|
println(true)
|
||||||
|
println(3.14159)
|
||||||
|
println('A')
|
||||||
|
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())
|
||||||
|
array.decodeToString().apply { println(this) }
|
||||||
|
array.toKString().apply { println(this) }
|
||||||
|
}
|
||||||
+6
-1
@@ -1,4 +1,9 @@
|
|||||||
Hello
|
Hello, world!
|
||||||
|
123
|
||||||
|
239
|
||||||
|
true
|
||||||
|
3.14159
|
||||||
|
A
|
||||||
Привет
|
Привет
|
||||||
𐀀
|
𐀀
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// INPUT_DATA_FILE: readLine.in
|
||||||
|
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertEquals("Hello World", readLine())
|
||||||
|
assertNull(readLine())
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// INPUT_DATA_FILE: readLineEmpty.in
|
||||||
|
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertNull(readLine())
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// INPUT_DATA_FILE: readLineSingleEmptyLine.in
|
||||||
|
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertEquals("", readLine())
|
||||||
|
assertNull(readLine())
|
||||||
|
}
|
||||||
+7
-1
@@ -1 +1,7 @@
|
|||||||
A very long line of input with length of more than initial buffer size
|
first
|
||||||
|
|
||||||
|
second
|
||||||
|
aaaaaa
bbb
|
||||||
|
c
|
||||||
|
Привет!
|
||||||
|
A very long line of input with length of more than initial buffer size
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// INPUT_DATA_FILE: readln.in
|
||||||
|
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertEquals("first", readln())
|
||||||
|
assertEquals("", readln())
|
||||||
|
assertEquals("second", readln())
|
||||||
|
// NOTE: Between `bbb` and `c` is "\r\n". `readln()` treats it as a single line separator on all platforms.
|
||||||
|
assertContentEquals("aaaaaa\rbbb".encodeToByteArray(), readln().encodeToByteArray())
|
||||||
|
assertEquals("c", readln())
|
||||||
|
assertEquals("Привет!", readln())
|
||||||
|
assertEquals("A very long line of input with length of more than initial buffer size", readln())
|
||||||
|
assertNull(readlnOrNull())
|
||||||
|
assertFailsWith<RuntimeException> { readln() }
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// INPUT_DATA_FILE: readlnEmpty.in
|
||||||
|
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertFailsWith<RuntimeException> { readln() }
|
||||||
|
assertFailsWith<RuntimeException> { readln() }
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// INPUT_DATA_FILE: readlnOrNullEmpty.in
|
||||||
|
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertNull(readlnOrNull())
|
||||||
|
assertNull(readlnOrNull())
|
||||||
|
}
|
||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.jetbrains.kotlin.konan.test.blackbox;
|
||||||
|
|
||||||
|
import com.intellij.testFramework.TestDataPath;
|
||||||
|
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
|
import org.jetbrains.kotlin.konan.test.blackbox.support.EnforcedProperty;
|
||||||
|
import org.jetbrains.kotlin.konan.test.blackbox.support.ClassLevelProperty;
|
||||||
|
import org.jetbrains.kotlin.konan.test.blackbox.support.group.UseStandardTestCaseGroupProvider;
|
||||||
|
import org.jetbrains.kotlin.konan.test.blackbox.support.group.FirPipeline;
|
||||||
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
@TestMetadata("native/native.tests/testData/standalone")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@Tag("standalone")
|
||||||
|
@EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR")
|
||||||
|
@UseStandardTestCaseGroupProvider()
|
||||||
|
@Tag("frontend-fir")
|
||||||
|
@FirPipeline()
|
||||||
|
public class FirNativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInStandalone() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("native/native.tests/testData/standalone/console")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@Tag("standalone")
|
||||||
|
@EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR")
|
||||||
|
@UseStandardTestCaseGroupProvider()
|
||||||
|
@Tag("frontend-fir")
|
||||||
|
@FirPipeline()
|
||||||
|
public class Console {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInConsole() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone/console"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("println.kt")
|
||||||
|
public void testPrintln() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/println.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readLine.kt")
|
||||||
|
public void testReadLine() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readLine.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readLineEmpty.kt")
|
||||||
|
public void testReadLineEmpty() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readLineEmpty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readLineSingleEmptyLine.kt")
|
||||||
|
public void testReadLineSingleEmptyLine() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readLineSingleEmptyLine.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readln.kt")
|
||||||
|
public void testReadln() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readln.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readlnEmpty.kt")
|
||||||
|
public void testReadlnEmpty() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readlnEmpty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readlnOrNullEmpty.kt")
|
||||||
|
public void testReadlnOrNullEmpty() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readlnOrNullEmpty.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.jetbrains.kotlin.konan.test.blackbox;
|
||||||
|
|
||||||
|
import com.intellij.testFramework.TestDataPath;
|
||||||
|
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
|
import org.jetbrains.kotlin.konan.test.blackbox.support.EnforcedProperty;
|
||||||
|
import org.jetbrains.kotlin.konan.test.blackbox.support.ClassLevelProperty;
|
||||||
|
import org.jetbrains.kotlin.konan.test.blackbox.support.group.UseStandardTestCaseGroupProvider;
|
||||||
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
@TestMetadata("native/native.tests/testData/standalone")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@Tag("standalone")
|
||||||
|
@EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR")
|
||||||
|
@UseStandardTestCaseGroupProvider()
|
||||||
|
public class NativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInStandalone() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("native/native.tests/testData/standalone/console")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@Tag("standalone")
|
||||||
|
@EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR")
|
||||||
|
@UseStandardTestCaseGroupProvider()
|
||||||
|
public class Console {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInConsole() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone/console"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("println.kt")
|
||||||
|
public void testPrintln() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/println.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readLine.kt")
|
||||||
|
public void testReadLine() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readLine.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readLineEmpty.kt")
|
||||||
|
public void testReadLineEmpty() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readLineEmpty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readLineSingleEmptyLine.kt")
|
||||||
|
public void testReadLineSingleEmptyLine() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readLineSingleEmptyLine.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readln.kt")
|
||||||
|
public void testReadln() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readln.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readlnEmpty.kt")
|
||||||
|
public void testReadlnEmpty() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readlnEmpty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("readlnOrNullEmpty.kt")
|
||||||
|
public void testReadlnOrNullEmpty() throws Exception {
|
||||||
|
runTest("native/native.tests/testData/standalone/console/readlnOrNullEmpty.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -399,6 +399,29 @@ fun main() {
|
|||||||
model("klib/header-klibs/compilation", extension = null, recursive = false)
|
model("klib/header-klibs/compilation", extension = null, recursive = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Plain executable tests
|
||||||
|
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||||
|
testClass<AbstractNativeBlackBoxTest>(
|
||||||
|
suiteTestClassName = "NativeStandaloneTestGenerated",
|
||||||
|
annotations = listOf(
|
||||||
|
*standalone(),
|
||||||
|
provider<UseStandardTestCaseGroupProvider>(),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
model("standalone")
|
||||||
|
}
|
||||||
|
testClass<AbstractNativeBlackBoxTest>(
|
||||||
|
suiteTestClassName = "FirNativeStandaloneTestGenerated",
|
||||||
|
annotations = listOf(
|
||||||
|
*standalone(),
|
||||||
|
provider<UseStandardTestCaseGroupProvider>(),
|
||||||
|
*frontendFir(),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
model("standalone")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,3 +464,11 @@ private fun infrastructure() = annotation(Tag::class.java, "infrastructure")
|
|||||||
private fun k1libContents() = annotation(Tag::class.java, "k1libContents")
|
private fun k1libContents() = annotation(Tag::class.java, "k1libContents")
|
||||||
private fun k2libContents() = annotation(Tag::class.java, "k2libContents")
|
private fun k2libContents() = annotation(Tag::class.java, "k2libContents")
|
||||||
private fun atomicfuNative() = annotation(Tag::class.java, "atomicfu-native")
|
private fun atomicfuNative() = annotation(Tag::class.java, "atomicfu-native")
|
||||||
|
private fun standalone() = arrayOf(
|
||||||
|
annotation(Tag::class.java, "standalone"),
|
||||||
|
annotation(
|
||||||
|
EnforcedProperty::class.java,
|
||||||
|
"property" to ClassLevelProperty.TEST_KIND,
|
||||||
|
"propertyValue" to "STANDALONE_NO_TR"
|
||||||
|
)
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user