[K/N] Create test model for building/executing C-Interop tests
^KT-63287 Fixed
This commit is contained in:
committed by
Space Team
parent
8d20d5b16c
commit
1b1df9f0db
@@ -0,0 +1,2 @@
|
||||
language = Objective-C
|
||||
headers = library.h
|
||||
@@ -0,0 +1,7 @@
|
||||
#import "Foundation/NSString.h"
|
||||
#import "Foundation/NSObject.h"
|
||||
|
||||
@interface WithClassProperty : NSObject
|
||||
-(instancetype) init;
|
||||
@property (class, readonly, copy) NSString * stringProperty;
|
||||
@end
|
||||
@@ -0,0 +1,6 @@
|
||||
#import "library.h"
|
||||
|
||||
@implementation WithClassProperty : NSObject
|
||||
-(instancetype) init {}
|
||||
+ (NSString *) stringProperty { return @"153"; }
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlin.experimental.ExperimentalObjCName::class)
|
||||
|
||||
import library.*
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
@ObjCName("KotlinImplWithCompanionPropertyOverride")
|
||||
class Impl : WithClassProperty() {
|
||||
companion object : WithClassPropertyMeta() {
|
||||
override fun stringProperty(): String? = "42"
|
||||
}
|
||||
}
|
||||
|
||||
@ObjCName("KotlinImplWithoutCompanionPropertyOverride")
|
||||
class ImplWithoutOverride : WithClassProperty() {
|
||||
companion object : WithClassPropertyMeta() {
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
assertEquals("42", Impl.stringProperty())
|
||||
assertEquals("153", ImplWithoutOverride.stringProperty())
|
||||
}
|
||||
Reference in New Issue
Block a user