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,12 @@
|
||||
// The following 2 singletons are unused. However, since we are generating ObjC bindings for them,
|
||||
// they should be marked as used, so that the code generator emits their deinitialization.
|
||||
|
||||
object A {
|
||||
fun foo() = 1
|
||||
}
|
||||
|
||||
class B {
|
||||
companion object {
|
||||
fun foo() = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import Kt42397
|
||||
|
||||
class Results {
|
||||
var aFoo: Int32 = 0
|
||||
var bFoo: Int32 = 0
|
||||
}
|
||||
|
||||
func runTestKt42397(pointer: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? {
|
||||
autoreleasepool {
|
||||
let results = pointer.bindMemory(to: Results.self, capacity: 1).pointee
|
||||
results.aFoo = A().foo()
|
||||
results.bFoo = B.Companion().foo()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testKt42397() throws {
|
||||
let results = Results()
|
||||
let resultsPtr = UnsafeMutablePointer<Results>.allocate(capacity: 1)
|
||||
resultsPtr.initialize(to: results)
|
||||
var thread: pthread_t? = nil
|
||||
let result = pthread_create(&thread, nil, runTestKt42397, resultsPtr)
|
||||
try assertEquals(actual: result, expected: 0)
|
||||
pthread_join(thread!, nil)
|
||||
|
||||
try assertEquals(actual: results.aFoo, expected: 1)
|
||||
try assertEquals(actual: results.bFoo, expected: 2)
|
||||
}
|
||||
|
||||
// -------- Execution of the test --------
|
||||
|
||||
class TestTests : SimpleTestProvider {
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
test("Kt42397", testKt42397)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user