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,15 @@
|
||||
import kotlinx.cinterop.*
|
||||
import objclib.*
|
||||
import kotlin.native.ref.*
|
||||
|
||||
fun run(): List<Any?> {
|
||||
val result = mutableListOf<Any?>()
|
||||
result.add(foo1(42))
|
||||
val list = foo2(117)
|
||||
if (list != null) {
|
||||
result.add(list.size)
|
||||
for (x in list)
|
||||
result.add(x)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
language = Objective-C
|
||||
headers = Foundation/NSArray.h Foundation/NSValue.h Foundation/NSString.h
|
||||
headerFilter = **/objclib.h Foundation/NSArray.h Foundation/NSValue.h Foundation/NSString.h
|
||||
@@ -0,0 +1,11 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NSString* foo1(int x) {
|
||||
return [NSString stringWithFormat:@"%d", x];
|
||||
}
|
||||
|
||||
NSArray* foo2(int x) {
|
||||
NSValue* xx = @(x);
|
||||
NSString* s = @"zzz";
|
||||
return [NSArray arrayWithObjects: xx, s, nil];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import Foundation
|
||||
import Gh3343
|
||||
|
||||
func testGh3343() throws {
|
||||
let list = KtlibKt.run()
|
||||
try assertEquals(actual: list[0] as? String, expected: "42")
|
||||
try assertEquals(actual: list[1] as? Int, expected: 2)
|
||||
try assertEquals(actual: list[2] as? Int, expected: 117)
|
||||
try assertEquals(actual: list[3] as? String, expected: "zzz")
|
||||
}
|
||||
|
||||
// -------- Execution of the test --------
|
||||
|
||||
class UselibTests : TestProvider {
|
||||
var tests: [TestCase] = []
|
||||
|
||||
init() {
|
||||
providers.append(self)
|
||||
tests = [
|
||||
TestCase(name: "Gh3343", method: withAutorelease(testGh3343)),
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user