[K/N][Tests] Migrate test overridabilityCondition.kt
^KT-61259
This commit is contained in:
+45
-1
@@ -1,3 +1,45 @@
|
|||||||
|
// TARGET_BACKEND: NATIVE
|
||||||
|
// DISABLE_NATIVE: isAppleTarget=false
|
||||||
|
|
||||||
|
// MODULE: cinterop
|
||||||
|
// FILE: lib.def
|
||||||
|
language = Objective-C
|
||||||
|
headers = lib.h
|
||||||
|
headerFilter = lib.h
|
||||||
|
|
||||||
|
// FILE: lib.h
|
||||||
|
#import <Foundation/NSObject.h>
|
||||||
|
#import <Foundation/NSDate.h>
|
||||||
|
#import <Foundation/NSUUID.h>
|
||||||
|
|
||||||
|
@interface ObjCClass : NSObject
|
||||||
|
- (NSString*)fooWithArg:(int)arg arg2:(NSString*)arg2;
|
||||||
|
- (NSString*)fooWithArg:(int)ohNoOtherName name2:(NSString*)name2;
|
||||||
|
- (NSString*)fooWithArg:(int)arg name3:(NSString*)name3;
|
||||||
|
@end
|
||||||
|
|
||||||
|
// FILE: lib.m
|
||||||
|
#import "lib.h"
|
||||||
|
|
||||||
|
@implementation ObjCClass {
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)fooWithArg:(int)arg arg2:(NSString*)arg2 {
|
||||||
|
return @"A";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)fooWithArg:(int)ohNoOtherName name2:(NSString*)name2 {
|
||||||
|
return @"B";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)fooWithArg:(int)arg name3:(NSString*)name3 {
|
||||||
|
return @"C";
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
// MODULE: main(cinterop)
|
||||||
|
// FILE: main.kt
|
||||||
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||||
|
|
||||||
import lib.ObjCClass
|
import lib.ObjCClass
|
||||||
@@ -32,7 +74,7 @@ fun test(x: ObjCClass, expected: String) {
|
|||||||
if (res != expected) throw IllegalStateException("Fail ${x::class}: ${res} instead of $expected")
|
if (res != expected) throw IllegalStateException("Fail ${x::class}: ${res} instead of $expected")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
fun box(): String {
|
||||||
test(ObjCClass(), "ABC")
|
test(ObjCClass(), "ABC")
|
||||||
test(OverrideAll(), "DEF")
|
test(OverrideAll(), "DEF")
|
||||||
test(OverrideNone(), "ABC")
|
test(OverrideNone(), "ABC")
|
||||||
@@ -51,4 +93,6 @@ fun main() {
|
|||||||
x2.fooWithArg(ohNoOtherName = 0, name2="") +
|
x2.fooWithArg(ohNoOtherName = 0, name2="") +
|
||||||
x2.fooWithArg(arg = 0, name3 = "")
|
x2.fooWithArg(arg = 0, name3 = "")
|
||||||
if (res2 != "ABC") throw IllegalStateException("Fail OverrideNone non-virtual: ${res2} instead of ABC")
|
if (res2 != "ABC") throw IllegalStateException("Fail OverrideNone non-virtual: ${res2} instead of ABC")
|
||||||
|
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
@@ -1210,11 +1210,6 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
it.defFile 'interop/objc/objCAction/objclib.def'
|
it.defFile 'interop/objc/objCAction/objclib.def'
|
||||||
it.headers "$projectDir/interop/objc/objCAction/objclib.h"
|
it.headers "$projectDir/interop/objc/objCAction/objclib.h"
|
||||||
}
|
}
|
||||||
createInterop("overridabilityCondition") {
|
|
||||||
it.defFile 'interop/objc/overridabilityCondition/lib.def'
|
|
||||||
it.headers "$projectDir/interop/objc/overridabilityCondition/lib.h"
|
|
||||||
it.extraOpts "-Xcompile-source", "$projectDir/interop/objc/overridabilityCondition/lib.m"
|
|
||||||
}
|
|
||||||
createInterop("kt63423_dispose_on_main_stress") {
|
createInterop("kt63423_dispose_on_main_stress") {
|
||||||
it.defFile 'interop/objc/kt63423_dispose_on_main_stress/objclib.def'
|
it.defFile 'interop/objc/kt63423_dispose_on_main_stress/objclib.def'
|
||||||
it.headers "$projectDir/interop/objc/kt63423_dispose_on_main_stress/objclib.h"
|
it.headers "$projectDir/interop/objc/kt63423_dispose_on_main_stress/objclib.h"
|
||||||
@@ -1549,12 +1544,6 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
interop = "objcDirect"
|
interop = "objcDirect"
|
||||||
}
|
}
|
||||||
|
|
||||||
interopTest("interop_objc_overridabilityCondition") {
|
|
||||||
interop = "overridabilityCondition"
|
|
||||||
source = "interop/objc/overridabilityCondition/main.kt"
|
|
||||||
flags = [ "-Xuse-ir-fake-override-builder" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
interopTest("interop_objc_foreignException") {
|
interopTest("interop_objc_foreignException") {
|
||||||
source = "interop/objc/foreignException/objc_wrap.kt"
|
source = "interop/objc/foreignException/objc_wrap.kt"
|
||||||
interop = 'foreignException'
|
interop = 'foreignException'
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
language = Objective-C
|
|
||||||
headersFilter = **/lib.h
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#import <Foundation/NSObject.h>
|
|
||||||
#import <Foundation/NSDate.h>
|
|
||||||
#import <Foundation/NSUUID.h>
|
|
||||||
|
|
||||||
@interface ObjCClass : NSObject
|
|
||||||
- (NSString*)fooWithArg:(int)arg arg2:(NSString*)arg2;
|
|
||||||
- (NSString*)fooWithArg:(int)ohNoOtherName name2:(NSString*)name2;
|
|
||||||
- (NSString*)fooWithArg:(int)arg name3:(NSString*)name3;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#import "lib.h"
|
|
||||||
|
|
||||||
@implementation ObjCClass {
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString*)fooWithArg:(int)arg arg2:(NSString*)arg2 {
|
|
||||||
return @"A";
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString*)fooWithArg:(int)ohNoOtherName name2:(NSString*)name2 {
|
|
||||||
return @"B";
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString*)fooWithArg:(int)arg name3:(NSString*)name3 {
|
|
||||||
return @"C";
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
+6
@@ -5097,6 +5097,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
|||||||
public void testKt53151() throws Exception {
|
public void testKt53151() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridabilityCondition.kt")
|
||||||
|
public void testOverridabilityCondition() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/cinterop/objc/overridabilityCondition.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -5213,6 +5213,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
|||||||
public void testKt53151() throws Exception {
|
public void testKt53151() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridabilityCondition.kt")
|
||||||
|
public void testOverridabilityCondition() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/cinterop/objc/overridabilityCondition.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -4981,6 +4981,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
|||||||
public void testKt53151() throws Exception {
|
public void testKt53151() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridabilityCondition.kt")
|
||||||
|
public void testOverridabilityCondition() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/cinterop/objc/overridabilityCondition.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -5098,6 +5098,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
|||||||
public void testKt53151() throws Exception {
|
public void testKt53151() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("overridabilityCondition.kt")
|
||||||
|
public void testOverridabilityCondition() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/cinterop/objc/overridabilityCondition.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
Reference in New Issue
Block a user