Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise they would be ignored according .gitignore settings. Probably they should be deleted from repo. Interop/.idea/compiler.xml Interop/.idea/gradle.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml Interop/.idea/modules.xml Interop/.idea/modules/Indexer/Indexer.iml Interop/.idea/modules/Runtime/Runtime.iml Interop/.idea/modules/StubGenerator/StubGenerator.iml backend.native/backend.native.iml backend.native/bc.frontend/bc.frontend.iml backend.native/cli.bc/cli.bc.iml backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt backend.native/tests/link/lib/foo.kt backend.native/tests/link/lib/foo2.kt backend.native/tests/teamcity-test.property
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.exceptions.catch1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
try {
|
||||
println("Before")
|
||||
foo()
|
||||
println("After")
|
||||
} catch (e: Throwable) {
|
||||
println("Caught Throwable")
|
||||
}
|
||||
|
||||
println("Done")
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
throw Error("Error happens")
|
||||
println("After in foo()")
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.exceptions.catch2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
try {
|
||||
println("Before")
|
||||
foo()
|
||||
println("After")
|
||||
} catch (e: Exception) {
|
||||
println("Caught Exception")
|
||||
} catch (e: Error) {
|
||||
println("Caught Error")
|
||||
} catch (e: Throwable) {
|
||||
println("Caught Throwable")
|
||||
}
|
||||
|
||||
println("Done")
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
throw Error("Error happens")
|
||||
println("After in foo()")
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.exceptions.catch7
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test fun runTest() {
|
||||
try {
|
||||
foo()
|
||||
} catch (e: Throwable) {
|
||||
val message = e.message
|
||||
if (message != null) {
|
||||
println(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
throw Error("Error happens")
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Checks that on Apple targets first two lines of exception stacktrace of symbolized executable looks like
|
||||
// "\tat 1 main.kexe\t\t 0x000000010d7cdb4c kfun:package.function(kotlin.Int) + 108 (/path/to/file/name.kt:10:27)\n"
|
||||
// If test is broken, org.jetbrains.kotlin.idea.filters.KotlinExceptionFilter (in main Kotlin repo) should be updated.
|
||||
|
||||
import kotlin.test.*
|
||||
import kotlin.text.Regex
|
||||
|
||||
val EXTENSION = ".kt:"
|
||||
val LOCATION_PATTERN = Regex("\\d+:\\d+")
|
||||
|
||||
fun checkStringFormat(s: String) {
|
||||
val trimmed = s.trim()
|
||||
|
||||
assertTrue(trimmed.endsWith(')'), "Line is not ended with ')'")
|
||||
assertNotEquals(trimmed.indexOf('('), -1, "No '(' before filename")
|
||||
|
||||
val fileName = trimmed.substring(trimmed.lastIndexOf('(') + 1, trimmed.lastIndex)
|
||||
assertNotEquals(fileName.indexOf(EXTENSION), -1, "Filename 'kt' extension is absent")
|
||||
|
||||
val location = fileName.substring(fileName.indexOf(EXTENSION) + EXTENSION.length)
|
||||
assertTrue(LOCATION_PATTERN.matches(location), "Expected location of form 12:8")
|
||||
}
|
||||
|
||||
fun functionA() {
|
||||
throw Error("an error")
|
||||
}
|
||||
|
||||
fun functionB() {
|
||||
functionA()
|
||||
}
|
||||
|
||||
const val depth = 5
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
try {
|
||||
functionB()
|
||||
} catch (e: Throwable) {
|
||||
val stacktrace = e.getStackTrace()
|
||||
assert(stacktrace.size >= depth)
|
||||
stacktrace.take(depth).forEach(::checkStringFormat)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
assertFailsWith<InvalidMutabilityException> {
|
||||
setUnhandledExceptionHook { _ -> println("wrong") }
|
||||
}
|
||||
|
||||
val x = 42
|
||||
val old = setUnhandledExceptionHook({
|
||||
throwable: Throwable -> println("value $x: ${throwable::class.simpleName}")
|
||||
}.freeze())
|
||||
|
||||
assertNull(old)
|
||||
|
||||
throw Error("an error")
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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.exceptions.extend0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
class C : Exception("OK")
|
||||
|
||||
@Test fun runTest() {
|
||||
try {
|
||||
throw C()
|
||||
} catch (e: Throwable) {
|
||||
println(e.message!!)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import kotlin.text.Regex
|
||||
import kotlin.test.*
|
||||
|
||||
fun main() {
|
||||
try {
|
||||
foo()
|
||||
} catch (tw:Throwable) {
|
||||
val stackTrace = tw.getStackTrace()
|
||||
stackTrace.take(6).forEach(::checkFrame)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
myRun {
|
||||
//platform.darwin.NSObject()
|
||||
throwException()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun myRun(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
fun throwException() {
|
||||
throw Error()
|
||||
}
|
||||
internal val regex = Regex("^(\\d+)\\ +.*/(.*):(\\d+):.*$")
|
||||
internal val goldValues = arrayOf<Pair<String, Int>?>(
|
||||
null,
|
||||
null,
|
||||
"kt-37572.kt" to 25,
|
||||
"kt-37572.kt" to 16,
|
||||
"kt-37572.kt" to 6,
|
||||
"kt-37572.kt" to 4)
|
||||
|
||||
internal fun checkFrame(value:String) {
|
||||
val (pos, file, line) = regex.find(value)!!.destructured
|
||||
goldValues[pos.toInt()]?.let{
|
||||
assertEquals(it.first, file)
|
||||
assertEquals(it.second, line.toInt())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import kotlin.text.Regex
|
||||
import kotlin.test.*
|
||||
|
||||
fun exception() {
|
||||
error("FAIL!")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
try {
|
||||
exception()
|
||||
}
|
||||
catch (e:Exception) {
|
||||
val stackTrace = e.getStackTrace()
|
||||
stackTrace.take(6).forEach(::checkFrame)
|
||||
}
|
||||
}
|
||||
internal val regex = Regex("^(\\d+)\\ +.*/(.*):(\\d+):.*$")
|
||||
internal val goldValues = arrayOf<Pair<String, Int>?>(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"stack_trace_inline.kt" to 5,
|
||||
"stack_trace_inline.kt" to 10)
|
||||
internal fun checkFrame(value:String) {
|
||||
val (pos, file, line) = regex.find(value)!!.destructured
|
||||
goldValues[pos.toInt()]?.let{
|
||||
assertEquals(it.first, file)
|
||||
assertEquals(it.second, line.toInt())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user