[K/N] Cover objcClassesIncludingCategories with smoke tests
This commit is contained in:
committed by
Space Team
parent
a9d13338bd
commit
4ffb43c5bd
Vendored
+36
@@ -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()
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
# Check that we don't add category contents to classes by default
|
||||
language = Objective-C
|
||||
modules=dependency1
|
||||
Vendored
+40
@@ -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()
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
language = Objective-C
|
||||
modules=dependency1
|
||||
objcClassesIncludingCategories = MyClass
|
||||
Vendored
+32
@@ -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)
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
language = Objective-C
|
||||
modules=dependency2
|
||||
objcClassesIncludingCategories = MyClass
|
||||
Vendored
+23
@@ -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?
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
language = Objective-C
|
||||
modules=dependency3
|
||||
Vendored
+25
@@ -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?
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
language = Objective-C
|
||||
modules=dependency3
|
||||
objcClassesIncludingCategories = MyClass
|
||||
+24
@@ -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;
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
framework module dependency1 {
|
||||
umbrella header "dependency1.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
@interface MyClass
|
||||
@property float instanceProperty;
|
||||
@end;
|
||||
|
||||
@interface MyClass(IncludeCategory)
|
||||
@property float categoryProperty;
|
||||
@end;
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
framework module dependency2 {
|
||||
umbrella header "dependency2.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
@interface MyClass
|
||||
- (id)initWithFloat:(float)number;
|
||||
- (instancetype)initWithPointer:(void*)any;
|
||||
@end;
|
||||
|
||||
@interface MyClass(IncludeCategory)
|
||||
- (id)initWithAnother:(MyClass*) instance;
|
||||
@end;
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
framework module dependency3 {
|
||||
umbrella header "dependency3.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.blackboxtest;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/CInterop/frameworkIncludeCategories/cases")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CInteropIncludeCategoriesTestGenerated extends AbstractNativeCInteropIncludeCategoriesTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInCases() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/CInterop/frameworkIncludeCategories/cases"), Pattern.compile("^([^_](.+))$"), null, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke0")
|
||||
public void testSmoke0() throws Exception {
|
||||
runTest("native/native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke0/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke1")
|
||||
public void testSmoke1() throws Exception {
|
||||
runTest("native/native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke1/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke2")
|
||||
public void testSmoke2() throws Exception {
|
||||
runTest("native/native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke2/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke3")
|
||||
public void testSmoke3() throws Exception {
|
||||
runTest("native/native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke3/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("smoke4")
|
||||
public void testSmoke4() throws Exception {
|
||||
runTest("native/native.tests/testData/CInterop/frameworkIncludeCategories/cases/smoke4/");
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,11 @@ fun main() {
|
||||
) {
|
||||
model("CInterop/KT-39120/defs", pattern = "^([^_](.+))$", recursive = false)
|
||||
}
|
||||
testClass<AbstractNativeCInteropIncludeCategoriesTest>(
|
||||
suiteTestClassName = "CInteropIncludeCategoriesTestGenerated"
|
||||
) {
|
||||
model("CInterop/frameworkIncludeCategories/cases", pattern = "^([^_](.+))$", recursive = false)
|
||||
}
|
||||
}
|
||||
|
||||
// LLDB integration tests.
|
||||
|
||||
+8
@@ -35,6 +35,14 @@ abstract class AbstractNativeCInteropNoFModulesTest : AbstractNativeCInteropTest
|
||||
override val defFileName: String = "pod1.def"
|
||||
}
|
||||
|
||||
abstract class AbstractNativeCInteropIncludeCategoriesTest : AbstractNativeCInteropTest() {
|
||||
override val fmodules: Boolean
|
||||
get() = false
|
||||
|
||||
override val defFileName: String
|
||||
get() = "dependency.def"
|
||||
}
|
||||
|
||||
@Tag("cinterop")
|
||||
abstract class AbstractNativeCInteropTest : AbstractNativeCInteropBaseTest() {
|
||||
abstract val fmodules: Boolean
|
||||
|
||||
Reference in New Issue
Block a user