[K/N] Cover objcClassesIncludingCategories with smoke tests

This commit is contained in:
Sergey Bogolepov
2023-01-12 13:29:58 +02:00
committed by Space Team
parent a9d13338bd
commit 4ffb43c5bd
19 changed files with 296 additions and 0 deletions
@@ -0,0 +1,36 @@
package dependency {
@ExternalObjCClass open class MyClass : ObjCObjectBase {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "instanceMethod") open external fun instanceMethod()
companion object : MyClassMeta, ObjCClassOf<MyClass>
}
@ExternalObjCClass open class MyClassMeta : ObjCObjectBaseMeta {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "classMethod") open external fun classMethod()
}
@ExternalObjCClass open class SkipClass : ObjCObjectBase {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "instanceMethod") open external fun instanceMethod()
companion object : SkipClassMeta, ObjCClassOf<SkipClass>
}
@ExternalObjCClass open class SkipClassMeta : ObjCObjectBaseMeta {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "classMethod") open external fun classMethod()
}
}
package dependency {
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod") external fun MyClassMeta.categoryClassMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod") external fun SkipClassMeta.categoryClassMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod2") external fun MyClassMeta.categoryClassMethod2()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod") external fun MyClass.categoryInstanceMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod") external fun SkipClass.categoryInstanceMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod2") external fun MyClass.categoryInstanceMethod2()
}
@@ -0,0 +1,3 @@
# Check that we don't add category contents to classes by default
language = Objective-C
modules=dependency1
@@ -0,0 +1,40 @@
package dependency {
@ExternalObjCClass open class MyClass : ObjCObjectBase {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod") open external fun categoryInstanceMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod2") open external fun categoryInstanceMethod2()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "instanceMethod") open external fun instanceMethod()
companion object : MyClassMeta, ObjCClassOf<MyClass>
}
@ExternalObjCClass open class MyClassMeta : ObjCObjectBaseMeta {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod") open external fun categoryClassMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod2") open external fun categoryClassMethod2()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "classMethod") open external fun classMethod()
}
@ExternalObjCClass open class SkipClass : ObjCObjectBase {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "instanceMethod") open external fun instanceMethod()
companion object : SkipClassMeta, ObjCClassOf<SkipClass>
}
@ExternalObjCClass open class SkipClassMeta : ObjCObjectBaseMeta {
protected constructor()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "classMethod") open external fun classMethod()
}
}
package dependency {
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod") @Deprecated(level = DeprecationLevel.WARNING, message = "Use class method instead", replaceWith = ReplaceWith(imports = {})) external fun MyClassMeta.categoryClassMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod") external fun SkipClassMeta.categoryClassMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryClassMethod2") @Deprecated(level = DeprecationLevel.WARNING, message = "Use class method instead", replaceWith = ReplaceWith(imports = {})) external fun MyClassMeta.categoryClassMethod2()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod") @Deprecated(level = DeprecationLevel.WARNING, message = "Use instance method instead", replaceWith = ReplaceWith(imports = {})) external fun MyClass.categoryInstanceMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod") external fun SkipClass.categoryInstanceMethod()
@ObjCMethod(encoding = "v16@0:8", isStret = false, selector = "categoryInstanceMethod2") @Deprecated(level = DeprecationLevel.WARNING, message = "Use instance method instead", replaceWith = ReplaceWith(imports = {})) external fun MyClass.categoryInstanceMethod2()
}
@@ -0,0 +1,3 @@
language = Objective-C
modules=dependency1
objcClassesIncludingCategories = MyClass
@@ -0,0 +1,32 @@
package dependency {
@ExternalObjCClass open class MyClass : ObjCObjectBase {
protected constructor()
var categoryProperty: Float
@ObjCMethod(encoding = "f16@0:8", isStret = false, selector = "categoryProperty") get
@ObjCMethod(encoding = "v20@0:8f16", isStret = false, selector = "setCategoryProperty:") set
var instanceProperty: Float
@ObjCMethod(encoding = "f16@0:8", isStret = false, selector = "instanceProperty") get
@ObjCMethod(encoding = "v20@0:8f16", isStret = false, selector = "setInstanceProperty:") set
@ObjCMethod(encoding = "f16@0:8", isStret = false, selector = "categoryProperty") open external fun categoryProperty(): Float
@ObjCMethod(encoding = "f16@0:8", isStret = false, selector = "instanceProperty") open external fun instanceProperty(): Float
@ObjCMethod(encoding = "v20@0:8f16", isStret = false, selector = "setCategoryProperty:") open external fun setCategoryProperty(categoryProperty: Float)
@ObjCMethod(encoding = "v20@0:8f16", isStret = false, selector = "setInstanceProperty:") open external fun setInstanceProperty(instanceProperty: Float)
companion object : MyClassMeta, ObjCClassOf<MyClass>
}
@ExternalObjCClass open class MyClassMeta : ObjCObjectBaseMeta {
protected constructor()
}
}
package dependency {
@Deprecated(level = DeprecationLevel.WARNING, message = "Use instance property instead", replaceWith = ReplaceWith(imports = {})) var MyClass.categoryProperty: Float
@ObjCMethod(encoding = "f16@0:8", isStret = false, selector = "categoryProperty") @Deprecated(level = DeprecationLevel.WARNING, message = "Use instance method instead", replaceWith = ReplaceWith(imports = {})) get
@ObjCMethod(encoding = "v20@0:8f16", isStret = false, selector = "setCategoryProperty:") @Deprecated(level = DeprecationLevel.WARNING, message = "Use instance method instead", replaceWith = ReplaceWith(imports = {})) set
@ObjCMethod(encoding = "f16@0:8", isStret = false, selector = "categoryProperty") @Deprecated(level = DeprecationLevel.WARNING, message = "Use instance method instead", replaceWith = ReplaceWith(imports = {})) external fun MyClass.categoryProperty(): Float
@ObjCMethod(encoding = "v20@0:8f16", isStret = false, selector = "setCategoryProperty:") @Deprecated(level = DeprecationLevel.WARNING, message = "Use instance method instead", replaceWith = ReplaceWith(imports = {})) external fun MyClass.setCategoryProperty(categoryProperty: Float)
}
@@ -0,0 +1,3 @@
language = Objective-C
modules=dependency2
objcClassesIncludingCategories = MyClass
@@ -0,0 +1,23 @@
package dependency {
@ExternalObjCClass open class MyClass : ObjCObjectBase {
@ObjCConstructor(designated = true, initSelector = "initWithFloat:") constructor(float: Float)
@ObjCConstructor(designated = true, initSelector = "initWithPointer:") constructor(pointer: COpaquePointer? /* = CPointer<out CPointed>? */)
protected constructor()
@Deprecated(level = DeprecationLevel.ERROR, message = "Use constructor instead", replaceWith = ReplaceWith(expression = "MyClass(number)", imports = {})) @ObjCMethod(encoding = "@20@0:8f16", isStret = false, selector = "initWithFloat:") @CCall.ConsumesReceiver @CCall.ReturnsRetained open external fun initWithFloat(number: Float): Any?
@Deprecated(level = DeprecationLevel.ERROR, message = "Use constructor instead", replaceWith = ReplaceWith(expression = "MyClass(any)", imports = {})) @ObjCMethod(encoding = "@24@0:8^v16", isStret = false, selector = "initWithPointer:") @CCall.ConsumesReceiver @CCall.ReturnsRetained open external fun initWithPointer(any: COpaquePointer? /* = CPointer<out CPointed>? */): MyClass?
companion object : MyClassMeta, ObjCClassOf<MyClass>
}
@ExternalObjCClass open class MyClassMeta : ObjCObjectBaseMeta {
protected constructor()
}
}
package dependency {
@ObjCFactory(encoding = "@24@0:8@16", isStret = false, selector = "initWithAnother:") @CCall.ConsumesReceiver @CCall.ReturnsRetained external fun <T : MyClass> ObjCClassOf<T>.create(another: MyClass?): T?
@Deprecated(level = DeprecationLevel.ERROR, message = "Use factory method instead", replaceWith = ReplaceWith(expression = "MyClass.create(instance)", imports = {})) @ObjCMethod(encoding = "@24@0:8@16", isStret = false, selector = "initWithAnother:") @CCall.ConsumesReceiver @CCall.ReturnsRetained external fun MyClass.initWithAnother(instance: MyClass?): Any?
}
@@ -0,0 +1,2 @@
language = Objective-C
modules=dependency3
@@ -0,0 +1,25 @@
package dependency {
@ExternalObjCClass open class MyClass : ObjCObjectBase {
@ObjCConstructor(designated = true, initSelector = "initWithFloat:") constructor(float: Float)
@ObjCConstructor(designated = true, initSelector = "initWithPointer:") constructor(pointer: COpaquePointer? /* = CPointer<out CPointed>? */)
@ObjCConstructor(designated = true, initSelector = "initWithAnother:") constructor(another: MyClass?)
protected constructor()
@Deprecated(level = DeprecationLevel.ERROR, message = "Use constructor instead", replaceWith = ReplaceWith(expression = "MyClass(instance)", imports = {})) @ObjCMethod(encoding = "@24@0:8@16", isStret = false, selector = "initWithAnother:") @CCall.ConsumesReceiver @CCall.ReturnsRetained open external fun initWithAnother(instance: MyClass?): Any?
@Deprecated(level = DeprecationLevel.ERROR, message = "Use constructor instead", replaceWith = ReplaceWith(expression = "MyClass(number)", imports = {})) @ObjCMethod(encoding = "@20@0:8f16", isStret = false, selector = "initWithFloat:") @CCall.ConsumesReceiver @CCall.ReturnsRetained open external fun initWithFloat(number: Float): Any?
@Deprecated(level = DeprecationLevel.ERROR, message = "Use constructor instead", replaceWith = ReplaceWith(expression = "MyClass(any)", imports = {})) @ObjCMethod(encoding = "@24@0:8^v16", isStret = false, selector = "initWithPointer:") @CCall.ConsumesReceiver @CCall.ReturnsRetained open external fun initWithPointer(any: COpaquePointer? /* = CPointer<out CPointed>? */): MyClass?
companion object : MyClassMeta, ObjCClassOf<MyClass>
}
@ExternalObjCClass open class MyClassMeta : ObjCObjectBaseMeta {
protected constructor()
}
}
package dependency {
@ObjCFactory(encoding = "@24@0:8@16", isStret = false, selector = "initWithAnother:") @CCall.ConsumesReceiver @CCall.ReturnsRetained external fun <T : MyClass> ObjCClassOf<T>.create(another: MyClass?): T?
@Deprecated(level = DeprecationLevel.ERROR, message = "Use factory method instead", replaceWith = ReplaceWith(expression = "MyClass.create(instance)", imports = {})) @ObjCMethod(encoding = "@24@0:8@16", isStret = false, selector = "initWithAnother:") @CCall.ConsumesReceiver @CCall.ReturnsRetained external fun MyClass.initWithAnother(instance: MyClass?): Any?
}
@@ -0,0 +1,3 @@
language = Objective-C
modules=dependency3
objcClassesIncludingCategories = MyClass
@@ -0,0 +1,24 @@
@interface MyClass
-(void) instanceMethod;
+(void) classMethod;
@end;
@interface MyClass(IncludeCategory)
-(void) categoryInstanceMethod;
+(void) categoryClassMethod;
@end;
@interface MyClass(IncludeCategory2)
-(void) categoryInstanceMethod2;
+(void) categoryClassMethod2;
@end;
@interface SkipClass
-(void) instanceMethod;
+(void) classMethod;
@end
@interface SkipClass(IncludeCategory)
-(void) categoryInstanceMethod;
+(void) categoryClassMethod;
@end;
@@ -0,0 +1,6 @@
framework module dependency1 {
umbrella header "dependency1.h"
export *
module * { export * }
}
@@ -0,0 +1,7 @@
@interface MyClass
@property float instanceProperty;
@end;
@interface MyClass(IncludeCategory)
@property float categoryProperty;
@end;
@@ -0,0 +1,6 @@
framework module dependency2 {
umbrella header "dependency2.h"
export *
module * { export * }
}
@@ -0,0 +1,8 @@
@interface MyClass
- (id)initWithFloat:(float)number;
- (instancetype)initWithPointer:(void*)any;
@end;
@interface MyClass(IncludeCategory)
- (id)initWithAnother:(MyClass*) instance;
@end;
@@ -0,0 +1,6 @@
framework module dependency3 {
umbrella header "dependency3.h"
export *
module * { export * }
}