diff --git a/kotlin-native/backend.native/tests/.gitattributes b/kotlin-native/backend.native/tests/.gitattributes deleted file mode 100644 index 19937df4f58..00000000000 --- a/kotlin-native/backend.native/tests/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -runtime/basic/readln*CR*.in binary -runtime/basic/readln*CR*.out binary \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index efa4a82cf29..46b416f36c0 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -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" diff --git a/kotlin-native/backend.native/tests/runtime/basic/for0.kt b/kotlin-native/backend.native/tests/runtime/basic/for0.kt deleted file mode 100644 index 1dd37fb04d2..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/for0.kt +++ /dev/null @@ -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) - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/for0.out b/kotlin-native/backend.native/tests/runtime/basic/for0.out deleted file mode 100644 index dcf37cd5e26..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/for0.out +++ /dev/null @@ -1,3 +0,0 @@ -2 -3 -4 diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello0.kt b/kotlin-native/backend.native/tests/runtime/basic/hello0.kt deleted file mode 100644 index 761e65ce3ec..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello0.kt +++ /dev/null @@ -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!") -} diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello0.out b/kotlin-native/backend.native/tests/runtime/basic/hello0.out deleted file mode 100644 index af5626b4a11..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello0.out +++ /dev/null @@ -1 +0,0 @@ -Hello, world! diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello1.kt b/kotlin-native/backend.native/tests/runtime/basic/hello1.kt deleted file mode 100644 index b08c1f3e65e..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello1.kt +++ /dev/null @@ -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) { - print(readLine().toString()) -} diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello1.out b/kotlin-native/backend.native/tests/runtime/basic/hello1.out deleted file mode 100644 index 5e1c309dae7..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello1.out +++ /dev/null @@ -1 +0,0 @@ -Hello World \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello2.in b/kotlin-native/backend.native/tests/runtime/basic/hello2.in deleted file mode 100644 index 557db03de99..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello2.in +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello2.kt b/kotlin-native/backend.native/tests/runtime/basic/hello2.kt deleted file mode 100644 index 4418fb815ef..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello2.kt +++ /dev/null @@ -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) { - print("you entered '" + readLine() + "'") -} diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello2.out b/kotlin-native/backend.native/tests/runtime/basic/hello2.out deleted file mode 100644 index 6bfe6aa6ce3..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello2.out +++ /dev/null @@ -1 +0,0 @@ -you entered 'Hello World' \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello3.kt b/kotlin-native/backend.native/tests/runtime/basic/hello3.kt deleted file mode 100644 index f52bec265b8..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello3.kt +++ /dev/null @@ -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') -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello3.out b/kotlin-native/backend.native/tests/runtime/basic/hello3.out deleted file mode 100644 index e6739c2ed25..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello3.out +++ /dev/null @@ -1,4 +0,0 @@ -239 -true -3.14159 -A diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello4.kt b/kotlin-native/backend.native/tests/runtime/basic/hello4.kt deleted file mode 100644 index dacd5b11a70..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello4.kt +++ /dev/null @@ -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 "Пока") - } \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello4.out b/kotlin-native/backend.native/tests/runtime/basic/hello4.out deleted file mode 100644 index 74075eaa752..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/hello4.out +++ /dev/null @@ -1,2 +0,0 @@ -Hello -Пока diff --git a/kotlin-native/backend.native/tests/runtime/basic/print_utf8.kt b/kotlin-native/backend.native/tests/runtime/basic/print_utf8.kt deleted file mode 100644 index 1cffba08da5..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/print_utf8.kt +++ /dev/null @@ -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) - } -} diff --git a/kotlin-native/backend.native/tests/runtime/basic/readline0.in b/kotlin-native/backend.native/tests/runtime/basic/readline0.in deleted file mode 100644 index 87523dd7a06..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readline0.in +++ /dev/null @@ -1 +0,0 @@ -41 diff --git a/kotlin-native/backend.native/tests/runtime/basic/readline0.kt b/kotlin-native/backend.native/tests/runtime/basic/readline0.kt deleted file mode 100644 index d158665106a..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readline0.kt +++ /dev/null @@ -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) { - print(readLine()!!.toInt()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readline0.out b/kotlin-native/backend.native/tests/runtime/basic/readline0.out deleted file mode 100644 index aaa6442fe90..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readline0.out +++ /dev/null @@ -1 +0,0 @@ -41 \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readline1.kt b/kotlin-native/backend.native/tests/runtime/basic/readline1.kt deleted file mode 100644 index 3dc9b11df78..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readline1.kt +++ /dev/null @@ -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) { - print(readLine()!!) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.kt b/kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.kt deleted file mode 100644 index 9e1dd470c7c..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.kt +++ /dev/null @@ -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()}") -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.out b/kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.out deleted file mode 100644 index e39a5b1474b..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.out +++ /dev/null @@ -1 +0,0 @@ -null/null/null \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.in b/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.in deleted file mode 100644 index b693390b561..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.in +++ /dev/null @@ -1,2 +0,0 @@ -aaaaaa bbb -c diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.kt deleted file mode 100644 index 1c3693ba85c..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.kt +++ /dev/null @@ -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()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.out b/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.out deleted file mode 100644 index e49b14c9cd0..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_CR_and_CRLF.out +++ /dev/null @@ -1 +0,0 @@ -aaaaaa bbb \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.in b/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.in deleted file mode 100644 index 67c32976114..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.in +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.kt deleted file mode 100644 index 1c3693ba85c..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.kt +++ /dev/null @@ -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()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.out b/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.out deleted file mode 100644 index 67c32976114..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_alone_CR.out +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.in b/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.in deleted file mode 100644 index 82383acd0ff..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.in +++ /dev/null @@ -1 +0,0 @@ -Привет! \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.kt deleted file mode 100644 index 1c3693ba85c..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.kt +++ /dev/null @@ -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()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.out b/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.out deleted file mode 100644 index 82383acd0ff..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_cyrillic.out +++ /dev/null @@ -1 +0,0 @@ -Привет! \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_empty.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_empty.kt deleted file mode 100644 index 41bcb8d78ee..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_empty.kt +++ /dev/null @@ -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() -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.in b/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.in deleted file mode 100644 index 8b137891791..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.in +++ /dev/null @@ -1 +0,0 @@ - diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.kt deleted file mode 100644 index 1c3693ba85c..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.kt +++ /dev/null @@ -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()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.out b/kotlin-native/backend.native/tests/runtime/basic/readln_empty_new_line.out deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.in b/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.in deleted file mode 100644 index 4ec4671b351..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.in +++ /dev/null @@ -1 +0,0 @@ -A very long line of input with length of more than initial buffer size \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.kt deleted file mode 100644 index 1c3693ba85c..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.kt +++ /dev/null @@ -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()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.in b/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.in deleted file mode 100644 index f08506a0deb..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.in +++ /dev/null @@ -1,3 +0,0 @@ -Hello World -Second line -Third line \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.kt deleted file mode 100644 index 1c3693ba85c..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.kt +++ /dev/null @@ -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()) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.out b/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.out deleted file mode 100644 index 5e1c309dae7..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_multiline.out +++ /dev/null @@ -1 +0,0 @@ -Hello World \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.in b/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.in deleted file mode 100644 index 1f3d4da6d2a..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.in +++ /dev/null @@ -1,4 +0,0 @@ -first -second - - diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.kt b/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.kt deleted file mode 100644 index ea8fcef7263..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.kt +++ /dev/null @@ -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()}") -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.out b/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.out deleted file mode 100644 index 323210d731d..00000000000 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_multiple_empty_new_lines.out +++ /dev/null @@ -1 +0,0 @@ -first/second///null \ No newline at end of file diff --git a/native/native.tests/build.gradle.kts b/native/native.tests/build.gradle.kts index d362a619d32..02c2ea3c2eb 100644 --- a/native/native.tests/build.gradle.kts +++ b/native/native.tests/build.gradle.kts @@ -52,6 +52,7 @@ val cinteropTest = nativeTest("cinteropTest", "cinterop") val debuggerTest = nativeTest("debuggerTest", "debugger") val cachesTest = nativeTest("cachesTest", "caches") val klibTest = nativeTest("klibTest", "klib") +val standaloneTest = nativeTest("standaloneTest", "standalone") val testTags = findProperty("kotlin.native.tests.tags")?.toString() // Note: arbitrary JUnit tag expressions can be used in this property. diff --git a/native/native.tests/testData/standalone/console/.gitattributes b/native/native.tests/testData/standalone/console/.gitattributes new file mode 100644 index 00000000000..3b298536143 --- /dev/null +++ b/native/native.tests/testData/standalone/console/.gitattributes @@ -0,0 +1,2 @@ +*.in binary +*.out binary \ No newline at end of file diff --git a/native/native.tests/testData/standalone/console/println.kt b/native/native.tests/testData/standalone/console/println.kt new file mode 100644 index 00000000000..05522d55775 --- /dev/null +++ b/native/native.tests/testData/standalone/console/println.kt @@ -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) } +} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/print_utf8.out b/native/native.tests/testData/standalone/console/println.out similarity index 59% rename from kotlin-native/backend.native/tests/runtime/basic/print_utf8.out rename to native/native.tests/testData/standalone/console/println.out index ee8acd96199..623a6ea7f0e 100644 --- a/kotlin-native/backend.native/tests/runtime/basic/print_utf8.out +++ b/native/native.tests/testData/standalone/console/println.out @@ -1,4 +1,9 @@ -Hello +Hello, world! +123 +239 +true +3.14159 +A Привет 𐀀 diff --git a/kotlin-native/backend.native/tests/runtime/basic/hello1.in b/native/native.tests/testData/standalone/console/readLine.in similarity index 100% rename from kotlin-native/backend.native/tests/runtime/basic/hello1.in rename to native/native.tests/testData/standalone/console/readLine.in diff --git a/native/native.tests/testData/standalone/console/readLine.kt b/native/native.tests/testData/standalone/console/readLine.kt new file mode 100644 index 00000000000..9196b3bd199 --- /dev/null +++ b/native/native.tests/testData/standalone/console/readLine.kt @@ -0,0 +1,8 @@ +// INPUT_DATA_FILE: readLine.in + +import kotlin.test.* + +fun main() { + assertEquals("Hello World", readLine()) + assertNull(readLine()) +} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readline1.out b/native/native.tests/testData/standalone/console/readLineEmpty.in similarity index 100% rename from kotlin-native/backend.native/tests/runtime/basic/readline1.out rename to native/native.tests/testData/standalone/console/readLineEmpty.in diff --git a/native/native.tests/testData/standalone/console/readLineEmpty.kt b/native/native.tests/testData/standalone/console/readLineEmpty.kt new file mode 100644 index 00000000000..75c45704726 --- /dev/null +++ b/native/native.tests/testData/standalone/console/readLineEmpty.kt @@ -0,0 +1,7 @@ +// INPUT_DATA_FILE: readLineEmpty.in + +import kotlin.test.* + +fun main() { + assertNull(readLine()) +} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readline1.in b/native/native.tests/testData/standalone/console/readLineSingleEmptyLine.in similarity index 100% rename from kotlin-native/backend.native/tests/runtime/basic/readline1.in rename to native/native.tests/testData/standalone/console/readLineSingleEmptyLine.in diff --git a/native/native.tests/testData/standalone/console/readLineSingleEmptyLine.kt b/native/native.tests/testData/standalone/console/readLineSingleEmptyLine.kt new file mode 100644 index 00000000000..a7a76fbc694 --- /dev/null +++ b/native/native.tests/testData/standalone/console/readLineSingleEmptyLine.kt @@ -0,0 +1,8 @@ +// INPUT_DATA_FILE: readLineSingleEmptyLine.in + +import kotlin.test.* + +fun main() { + assertEquals("", readLine()) + assertNull(readLine()) +} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.out b/native/native.tests/testData/standalone/console/readln.in similarity index 56% rename from kotlin-native/backend.native/tests/runtime/basic/readln_long_line.out rename to native/native.tests/testData/standalone/console/readln.in index 4ec4671b351..acd99379a0e 100644 --- a/kotlin-native/backend.native/tests/runtime/basic/readln_long_line.out +++ b/native/native.tests/testData/standalone/console/readln.in @@ -1 +1,7 @@ -A very long line of input with length of more than initial buffer size \ No newline at end of file +first + +second +aaaaaa bbb +c +Привет! +A very long line of input with length of more than initial buffer size diff --git a/native/native.tests/testData/standalone/console/readln.kt b/native/native.tests/testData/standalone/console/readln.kt new file mode 100644 index 00000000000..f67eec6a112 --- /dev/null +++ b/native/native.tests/testData/standalone/console/readln.kt @@ -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 { readln() } +} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.in b/native/native.tests/testData/standalone/console/readlnEmpty.in similarity index 100% rename from kotlin-native/backend.native/tests/runtime/basic/readlnOrNull_empty.in rename to native/native.tests/testData/standalone/console/readlnEmpty.in diff --git a/native/native.tests/testData/standalone/console/readlnEmpty.kt b/native/native.tests/testData/standalone/console/readlnEmpty.kt new file mode 100644 index 00000000000..bdf9f890294 --- /dev/null +++ b/native/native.tests/testData/standalone/console/readlnEmpty.kt @@ -0,0 +1,8 @@ +// INPUT_DATA_FILE: readlnEmpty.in + +import kotlin.test.* + +fun main() { + assertFailsWith { readln() } + assertFailsWith { readln() } +} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/basic/readln_empty.in b/native/native.tests/testData/standalone/console/readlnOrNullEmpty.in similarity index 100% rename from kotlin-native/backend.native/tests/runtime/basic/readln_empty.in rename to native/native.tests/testData/standalone/console/readlnOrNullEmpty.in diff --git a/native/native.tests/testData/standalone/console/readlnOrNullEmpty.kt b/native/native.tests/testData/standalone/console/readlnOrNullEmpty.kt new file mode 100644 index 00000000000..d28d3dcfe45 --- /dev/null +++ b/native/native.tests/testData/standalone/console/readlnOrNullEmpty.kt @@ -0,0 +1,8 @@ +// INPUT_DATA_FILE: readlnOrNullEmpty.in + +import kotlin.test.* + +fun main() { + assertNull(readlnOrNull()) + assertNull(readlnOrNull()) +} \ No newline at end of file diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeStandaloneTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeStandaloneTestGenerated.java new file mode 100644 index 00000000000..76de8f20975 --- /dev/null +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeStandaloneTestGenerated.java @@ -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"); + } + } +} diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeStandaloneTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeStandaloneTestGenerated.java new file mode 100644 index 00000000000..f221f4ba1d0 --- /dev/null +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeStandaloneTestGenerated.java @@ -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"); + } + } +} diff --git a/native/native.tests/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeTests.kt b/native/native.tests/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeTests.kt index e12c9d41f2e..e5e33082f7c 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeTests.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeTests.kt @@ -399,6 +399,29 @@ fun main() { model("klib/header-klibs/compilation", extension = null, recursive = false) } } + + // Plain executable tests + testGroup("native/native.tests/tests-gen", "native/native.tests/testData") { + testClass( + suiteTestClassName = "NativeStandaloneTestGenerated", + annotations = listOf( + *standalone(), + provider(), + ) + ) { + model("standalone") + } + testClass( + suiteTestClassName = "FirNativeStandaloneTestGenerated", + annotations = listOf( + *standalone(), + provider(), + *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 k2libContents() = annotation(Tag::class.java, "k2libContents") 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" + ) +) \ No newline at end of file