Files
kotlin-fork/kotlin-native/backend.native/tests/framework/forwardDeclarations/test.swift
T
Svyatoslav Scherbina 86a29a7b07 Native: correct ObjCExport test for forward declarations
The test relies on the fact that any name can be imported from a "magic"
package like `objcnames.classes`.
This was the case for K1, but likely won't be for K2: the compiler
should allow importing only those names that are actually
forward-declared in a cinterop library.

This commit changes the test that way. In particular, moves it to a
different task that has a cinterop dependency.
2023-01-30 11:00:32 +00:00

26 lines
778 B
Swift

import ForwardDeclarations
private func test1() throws {
let ptr = UnsafeMutableRawPointer(bitPattern: 0x1234)
try assertEquals(actual: LibKt.sameForwardDeclaredStruct(ptr: ptr), expected: ptr)
// We can't actually test this, because Swift can't import neither types nor functions due to
// "interface/protocol '...' is incomplete":
//
// let classObj: ForwardDeclaredClass? = nil
// try assertNil(LibKt.sameForwardDeclaredClass(obj: classObj))
//
// let protocolObj: ForwardDeclaredProtocol? = nil
// try assertNil(LibKt.sameForwardDeclaredProtocol(obj: protocolObj))
}
// -------- Execution of the test --------
class TestTests : SimpleTestProvider {
override init() {
super.init()
test("test1", test1)
}
}